diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 27be5c0477dd..44863ac41fe1 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -320,6 +320,7 @@ com.azure.resourcemanager:azure-resourcemanager-quota;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-extendedlocation;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-logz;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-storagepool;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-hybridconnectivity;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. diff --git a/pom.xml b/pom.xml index c48350b9b837..ff9b1f23ca0f 100644 --- a/pom.xml +++ b/pom.xml @@ -769,6 +769,7 @@ sdk/healthbot sdk/healthcareapis sdk/hybridcompute + sdk/hybridconnectivity sdk/hybridkubernetes sdk/hybridnetwork sdk/identity diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/CHANGELOG.md b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/CHANGELOG.md new file mode 100644 index 000000000000..fe5d0f24c2e3 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-10-14) + +- Azure Resource Manager HybridConnectivity client library for Java. This package contains Microsoft Azure SDK for HybridConnectivity Management SDK. REST API for Hybrid Connectivity. Package tag package-2021-10-06-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/hybridconnectivity/azure-resourcemanager-hybridconnectivity/README.md b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/README.md new file mode 100644 index 000000000000..6371297f56b1 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager HybridConnectivity client library for Java + +Azure Resource Manager HybridConnectivity client library for Java. + +This package contains Microsoft Azure SDK for HybridConnectivity Management SDK. REST API for Hybrid Connectivity. Package tag package-2021-10-06-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-hybridconnectivity;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-hybridconnectivity + 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(); +HybridConnectivityManager manager = HybridConnectivityManager + .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/hybridconnectivity/azure-resourcemanager-hybridconnectivity/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/hybridconnectivity/azure-resourcemanager-hybridconnectivity/SAMPLE.md b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/SAMPLE.md new file mode 100644 index 000000000000..91bcaebe8308 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/SAMPLE.md @@ -0,0 +1,244 @@ +# Code snippets and samples + + +## Endpoints + +- [CreateOrUpdate](#endpoints_createorupdate) +- [Delete](#endpoints_delete) +- [Get](#endpoints_get) +- [List](#endpoints_list) +- [ListCredentials](#endpoints_listcredentials) +- [Update](#endpoints_update) + +## Operations + +- [List](#operations_list) +### Endpoints_CreateOrUpdate + +```java +import com.azure.resourcemanager.hybridconnectivity.models.Type; + +/** Samples for Endpoints CreateOrUpdate. */ +public final class EndpointsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsPutCustom.json + */ + /** + * Sample code: HybridConnectivityEndpointsPutCustom. + * + * @param manager Entry point to HybridConnectivityManager. + */ + public static void hybridConnectivityEndpointsPutCustom( + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager) { + manager + .endpoints() + .define("custom") + .withExistingResourceUri( + "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine") + .withTypePropertiesType(Type.CUSTOM) + .withResourceId( + "/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.Relay/namespaces/custom-relay-namespace") + .create(); + } + + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsPutDefault.json + */ + /** + * Sample code: HybridConnectivityEndpointsPutDefault. + * + * @param manager Entry point to HybridConnectivityManager. + */ + public static void hybridConnectivityEndpointsPutDefault( + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager) { + manager + .endpoints() + .define("default") + .withExistingResourceUri( + "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine") + .withTypePropertiesType(Type.DEFAULT) + .create(); + } +} +``` + +### Endpoints_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Endpoints Delete. */ +public final class EndpointsDeleteSamples { + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsDeleteDefault.json + */ + /** + * Sample code: HybridConnectivityEndpointsDeleteDefault. + * + * @param manager Entry point to HybridConnectivityManager. + */ + public static void hybridConnectivityEndpointsDeleteDefault( + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager) { + manager + .endpoints() + .deleteWithResponse( + "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", + "default", + Context.NONE); + } +} +``` + +### Endpoints_Get + +```java +import com.azure.core.util.Context; + +/** Samples for Endpoints Get. */ +public final class EndpointsGetSamples { + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsGetDefault.json + */ + /** + * Sample code: HybridConnectivityEndpointsGetDefault. + * + * @param manager Entry point to HybridConnectivityManager. + */ + public static void hybridConnectivityEndpointsGetDefault( + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager) { + manager + .endpoints() + .getWithResponse( + "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", + "default", + Context.NONE); + } + + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsGetCustom.json + */ + /** + * Sample code: HybridConnectivityEndpointsGetCustom. + * + * @param manager Entry point to HybridConnectivityManager. + */ + public static void hybridConnectivityEndpointsGetCustom( + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager) { + manager + .endpoints() + .getWithResponse( + "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", + "custom", + Context.NONE); + } +} +``` + +### Endpoints_List + +```java +import com.azure.core.util.Context; + +/** Samples for Endpoints List. */ +public final class EndpointsListSamples { + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsList.json + */ + /** + * Sample code: HybridConnectivityEndpointsGet. + * + * @param manager Entry point to HybridConnectivityManager. + */ + public static void hybridConnectivityEndpointsGet( + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager) { + manager + .endpoints() + .list( + "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", + Context.NONE); + } +} +``` + +### Endpoints_ListCredentials + +```java +import com.azure.core.util.Context; + +/** Samples for Endpoints ListCredentials. */ +public final class EndpointsListCredentialsSamples { + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsPostListCredentials.json + */ + /** + * Sample code: HybridConnectivityEndpointsPostListCredentials. + * + * @param manager Entry point to HybridConnectivityManager. + */ + public static void hybridConnectivityEndpointsPostListCredentials( + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager) { + manager + .endpoints() + .listCredentialsWithResponse( + "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", + "default", + 10800L, + Context.NONE); + } +} +``` + +### Endpoints_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.hybridconnectivity.models.EndpointResource; +import com.azure.resourcemanager.hybridconnectivity.models.Type; + +/** Samples for Endpoints Update. */ +public final class EndpointsUpdateSamples { + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsPatchDefault.json + */ + /** + * Sample code: HybridConnectivityEndpointsPatchDefault. + * + * @param manager Entry point to HybridConnectivityManager. + */ + public static void hybridConnectivityEndpointsPatchDefault( + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager) { + EndpointResource resource = + manager + .endpoints() + .getWithResponse( + "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", + "default", + Context.NONE) + .getValue(); + resource.update().withTypePropertiesType(Type.DEFAULT).apply(); + } +} +``` + +### Operations_List + +```java +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/OperationsList.json + */ + /** + * Sample code: HybridConnectivityOperationsList. + * + * @param manager Entry point to HybridConnectivityManager. + */ + public static void hybridConnectivityOperationsList( + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager) { + manager.operations().list(Context.NONE); + } +} +``` + diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/pom.xml b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/pom.xml new file mode 100644 index 000000000000..f2195afdd6da --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/pom.xml @@ -0,0 +1,86 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-hybridconnectivity + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for HybridConnectivity Management + This package contains Microsoft Azure SDK for HybridConnectivity Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. REST API for Hybrid Connectivity. Package tag package-2021-10-06-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 + + + + + com.azure + azure-core + 1.21.0 + + + com.azure + azure-core-management + 1.4.2 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.7 + + true + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + + diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/HybridConnectivityManager.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/HybridConnectivityManager.java new file mode 100644 index 000000000000..797187257b5f --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/HybridConnectivityManager.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity; + +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.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.hybridconnectivity.fluent.HybridConnectivityManagementApi; +import com.azure.resourcemanager.hybridconnectivity.implementation.EndpointsImpl; +import com.azure.resourcemanager.hybridconnectivity.implementation.HybridConnectivityManagementApiBuilder; +import com.azure.resourcemanager.hybridconnectivity.implementation.OperationsImpl; +import com.azure.resourcemanager.hybridconnectivity.models.Endpoints; +import com.azure.resourcemanager.hybridconnectivity.models.Operations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to HybridConnectivityManager. REST API for Hybrid Connectivity. */ +public final class HybridConnectivityManager { + private Operations operations; + + private Endpoints endpoints; + + private final HybridConnectivityManagementApi clientObject; + + private HybridConnectivityManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new HybridConnectivityManagementApiBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of HybridConnectivity service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the HybridConnectivity service API instance. + */ + public static HybridConnectivityManager 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 HybridConnectivityManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new HybridConnectivityManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private 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, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of HybridConnectivity service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the HybridConnectivity service API instance. + */ + public HybridConnectivityManager 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.hybridconnectivity") + .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()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new HybridConnectivityManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of Endpoints. */ + public Endpoints endpoints() { + if (this.endpoints == null) { + this.endpoints = new EndpointsImpl(clientObject.getEndpoints(), this); + } + return endpoints; + } + + /** + * @return Wrapped service client HybridConnectivityManagementApi providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public HybridConnectivityManagementApi serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/EndpointsClient.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/EndpointsClient.java new file mode 100644 index 000000000000..ca2c3f3d40df --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/EndpointsClient.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.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.util.Context; +import com.azure.resourcemanager.hybridconnectivity.fluent.models.EndpointAccessResourceInner; +import com.azure.resourcemanager.hybridconnectivity.fluent.models.EndpointResourceInner; + +/** An instance of this class provides access to all the operations defined in EndpointsClient. */ +public interface EndpointsClient { + /** + * List of endpoints to the target 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 endpoints. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri); + + /** + * List of endpoints to the target 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 endpoints. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri, Context context); + + /** + * Gets the endpoint to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint to the resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EndpointResourceInner get(String resourceUri, String endpointName); + + /** + * Gets the endpoint to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint to the resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceUri, String endpointName, Context context); + + /** + * Create or update the endpoint to the target resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param endpointResource Endpoint 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 endpoint for the target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EndpointResourceInner createOrUpdate( + String resourceUri, String endpointName, EndpointResourceInner endpointResource); + + /** + * Create or update the endpoint to the target resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param endpointResource Endpoint 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 endpoint for the target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceUri, String endpointName, EndpointResourceInner endpointResource, Context context); + + /** + * Update the endpoint to the target resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param endpointResource Endpoint 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 endpoint for the target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EndpointResourceInner update(String resourceUri, String endpointName, EndpointResourceInner endpointResource); + + /** + * Update the endpoint to the target resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param endpointResource Endpoint 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 endpoint for the target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceUri, String endpointName, EndpointResourceInner endpointResource, Context context); + + /** + * Deletes the endpoint access to the target resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceUri, String endpointName); + + /** + * Deletes the endpoint access to the target resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceUri, String endpointName, Context context); + + /** + * Gets the endpoint access credentials to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint access credentials to the resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EndpointAccessResourceInner listCredentials(String resourceUri, String endpointName); + + /** + * Gets the endpoint access credentials to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param expiresin The is how long the endpoint access token is valid (in seconds). + * @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 endpoint access credentials to the resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listCredentialsWithResponse( + String resourceUri, String endpointName, Long expiresin, Context context); +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/HybridConnectivityManagementApi.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/HybridConnectivityManagementApi.java new file mode 100644 index 000000000000..b5dcb7a86cf2 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/HybridConnectivityManagementApi.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.hybridconnectivity.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for HybridConnectivityManagementApi class. */ +public interface HybridConnectivityManagementApi { + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the EndpointsClient object to access its operations. + * + * @return the EndpointsClient object. + */ + EndpointsClient getEndpoints(); +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/OperationsClient.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/OperationsClient.java new file mode 100644 index 000000000000..e623c4ceec9a --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.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.hybridconnectivity.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists the available Hybrid Connectivity 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists the available Hybrid Connectivity 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/EndpointAccessResourceInner.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/EndpointAccessResourceInner.java new file mode 100644 index 000000000000..652da751440e --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/EndpointAccessResourceInner.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The endpoint access for the target resource. */ +@Fluent +public final class EndpointAccessResourceInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EndpointAccessResourceInner.class); + + /* + * Azure relay hybrid connection access properties + */ + @JsonProperty(value = "relay") + private RelayNamespaceAccessProperties innerRelay; + + /** + * Get the innerRelay property: Azure relay hybrid connection access properties. + * + * @return the innerRelay value. + */ + private RelayNamespaceAccessProperties innerRelay() { + return this.innerRelay; + } + + /** + * Get the namespaceName property: The namespace name. + * + * @return the namespaceName value. + */ + public String namespaceName() { + return this.innerRelay() == null ? null : this.innerRelay().namespaceName(); + } + + /** + * Set the namespaceName property: The namespace name. + * + * @param namespaceName the namespaceName value to set. + * @return the EndpointAccessResourceInner object itself. + */ + public EndpointAccessResourceInner withNamespaceName(String namespaceName) { + if (this.innerRelay() == null) { + this.innerRelay = new RelayNamespaceAccessProperties(); + } + this.innerRelay().withNamespaceName(namespaceName); + return this; + } + + /** + * Get the namespaceNameSuffix property: The suffix domain name of relay namespace. + * + * @return the namespaceNameSuffix value. + */ + public String namespaceNameSuffix() { + return this.innerRelay() == null ? null : this.innerRelay().namespaceNameSuffix(); + } + + /** + * Set the namespaceNameSuffix property: The suffix domain name of relay namespace. + * + * @param namespaceNameSuffix the namespaceNameSuffix value to set. + * @return the EndpointAccessResourceInner object itself. + */ + public EndpointAccessResourceInner withNamespaceNameSuffix(String namespaceNameSuffix) { + if (this.innerRelay() == null) { + this.innerRelay = new RelayNamespaceAccessProperties(); + } + this.innerRelay().withNamespaceNameSuffix(namespaceNameSuffix); + return this; + } + + /** + * Get the hybridConnectionName property: Azure Relay hybrid connection name for the resource. + * + * @return the hybridConnectionName value. + */ + public String hybridConnectionName() { + return this.innerRelay() == null ? null : this.innerRelay().hybridConnectionName(); + } + + /** + * Set the hybridConnectionName property: Azure Relay hybrid connection name for the resource. + * + * @param hybridConnectionName the hybridConnectionName value to set. + * @return the EndpointAccessResourceInner object itself. + */ + public EndpointAccessResourceInner withHybridConnectionName(String hybridConnectionName) { + if (this.innerRelay() == null) { + this.innerRelay = new RelayNamespaceAccessProperties(); + } + this.innerRelay().withHybridConnectionName(hybridConnectionName); + return this; + } + + /** + * Get the accessKey property: Access key for hybrid connection. + * + * @return the accessKey value. + */ + public String accessKey() { + return this.innerRelay() == null ? null : this.innerRelay().accessKey(); + } + + /** + * Get the expiresOn property: The expiration of access key in unix time. + * + * @return the expiresOn value. + */ + public Long expiresOn() { + return this.innerRelay() == null ? null : this.innerRelay().expiresOn(); + } + + /** + * Set the expiresOn property: The expiration of access key in unix time. + * + * @param expiresOn the expiresOn value to set. + * @return the EndpointAccessResourceInner object itself. + */ + public EndpointAccessResourceInner withExpiresOn(Long expiresOn) { + if (this.innerRelay() == null) { + this.innerRelay = new RelayNamespaceAccessProperties(); + } + this.innerRelay().withExpiresOn(expiresOn); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerRelay() != null) { + innerRelay().validate(); + } + } +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/EndpointProperties.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/EndpointProperties.java new file mode 100644 index 000000000000..9e679239d4a7 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/EndpointProperties.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.hybridconnectivity.models.Type; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Endpoint details. */ +@Fluent +public final class EndpointProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EndpointProperties.class); + + /* + * The type of endpoint. + */ + @JsonProperty(value = "type", required = true) + private Type type; + + /* + * The resource Id of the connectivity endpoint (optional). + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /* + * The provisioningState property. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the type property: The type of endpoint. + * + * @return the type value. + */ + public Type type() { + return this.type; + } + + /** + * Set the type property: The type of endpoint. + * + * @param type the type value to set. + * @return the EndpointProperties object itself. + */ + public EndpointProperties withType(Type type) { + this.type = type; + return this; + } + + /** + * Get the resourceId property: The resource Id of the connectivity endpoint (optional). + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: The resource Id of the connectivity endpoint (optional). + * + * @param resourceId the resourceId value to set. + * @return the EndpointProperties object itself. + */ + public EndpointProperties withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model EndpointProperties")); + } + } +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/EndpointResourceInner.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/EndpointResourceInner.java new file mode 100644 index 000000000000..73fb96e6e18f --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/EndpointResourceInner.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.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.hybridconnectivity.models.Type; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The endpoint for the target resource. */ +@Fluent +public final class EndpointResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EndpointResourceInner.class); + + /* + * System data of endpoint resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData innerSystemData; + + /* + * The endpoint properties. + */ + @JsonProperty(value = "properties") + private EndpointProperties innerProperties; + + /** + * Get the innerSystemData property: System data of endpoint resource. + * + * @return the innerSystemData value. + */ + private SystemData innerSystemData() { + return this.innerSystemData; + } + + /** + * Get the innerProperties property: The endpoint properties. + * + * @return the innerProperties value. + */ + private EndpointProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of endpoint. + * + * @return the type value. + */ + public Type typePropertiesType() { + return this.innerProperties() == null ? null : this.innerProperties().type(); + } + + /** + * Set the type property: The type of endpoint. + * + * @param type the type value to set. + * @return the EndpointResourceInner object itself. + */ + public EndpointResourceInner withTypePropertiesType(Type type) { + if (this.innerProperties() == null) { + this.innerProperties = new EndpointProperties(); + } + this.innerProperties().withType(type); + return this; + } + + /** + * Get the resourceId property: The resource Id of the connectivity endpoint (optional). + * + * @return the resourceId value. + */ + public String resourceId() { + return this.innerProperties() == null ? null : this.innerProperties().resourceId(); + } + + /** + * Set the resourceId property: The resource Id of the connectivity endpoint (optional). + * + * @param resourceId the resourceId value to set. + * @return the EndpointResourceInner object itself. + */ + public EndpointResourceInner withResourceId(String resourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new EndpointProperties(); + } + this.innerProperties().withResourceId(resourceId); + return this; + } + + /** + * Get the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/OperationInner.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/OperationInner.java new file mode 100644 index 000000000000..3eec63d42199 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/OperationInner.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.hybridconnectivity.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.hybridconnectivity.models.ActionType; +import com.azure.resourcemanager.hybridconnectivity.models.OperationDisplay; +import com.azure.resourcemanager.hybridconnectivity.models.Origin; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * 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/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/RelayNamespaceAccessProperties.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/RelayNamespaceAccessProperties.java new file mode 100644 index 000000000000..55976328beb2 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/RelayNamespaceAccessProperties.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Azure relay hybrid connection access properties. */ +@Fluent +public final class RelayNamespaceAccessProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RelayNamespaceAccessProperties.class); + + /* + * The namespace name. + */ + @JsonProperty(value = "namespaceName", required = true) + private String namespaceName; + + /* + * The suffix domain name of relay namespace. + */ + @JsonProperty(value = "namespaceNameSuffix", required = true) + private String namespaceNameSuffix; + + /* + * Azure Relay hybrid connection name for the resource. + */ + @JsonProperty(value = "hybridConnectionName", required = true) + private String hybridConnectionName; + + /* + * Access key for hybrid connection. + */ + @JsonProperty(value = "accessKey", access = JsonProperty.Access.WRITE_ONLY) + private String accessKey; + + /* + * The expiration of access key in unix time. + */ + @JsonProperty(value = "expiresOn") + private Long expiresOn; + + /** + * Get the namespaceName property: The namespace name. + * + * @return the namespaceName value. + */ + public String namespaceName() { + return this.namespaceName; + } + + /** + * Set the namespaceName property: The namespace name. + * + * @param namespaceName the namespaceName value to set. + * @return the RelayNamespaceAccessProperties object itself. + */ + public RelayNamespaceAccessProperties withNamespaceName(String namespaceName) { + this.namespaceName = namespaceName; + return this; + } + + /** + * Get the namespaceNameSuffix property: The suffix domain name of relay namespace. + * + * @return the namespaceNameSuffix value. + */ + public String namespaceNameSuffix() { + return this.namespaceNameSuffix; + } + + /** + * Set the namespaceNameSuffix property: The suffix domain name of relay namespace. + * + * @param namespaceNameSuffix the namespaceNameSuffix value to set. + * @return the RelayNamespaceAccessProperties object itself. + */ + public RelayNamespaceAccessProperties withNamespaceNameSuffix(String namespaceNameSuffix) { + this.namespaceNameSuffix = namespaceNameSuffix; + return this; + } + + /** + * Get the hybridConnectionName property: Azure Relay hybrid connection name for the resource. + * + * @return the hybridConnectionName value. + */ + public String hybridConnectionName() { + return this.hybridConnectionName; + } + + /** + * Set the hybridConnectionName property: Azure Relay hybrid connection name for the resource. + * + * @param hybridConnectionName the hybridConnectionName value to set. + * @return the RelayNamespaceAccessProperties object itself. + */ + public RelayNamespaceAccessProperties withHybridConnectionName(String hybridConnectionName) { + this.hybridConnectionName = hybridConnectionName; + return this; + } + + /** + * Get the accessKey property: Access key for hybrid connection. + * + * @return the accessKey value. + */ + public String accessKey() { + return this.accessKey; + } + + /** + * Get the expiresOn property: The expiration of access key in unix time. + * + * @return the expiresOn value. + */ + public Long expiresOn() { + return this.expiresOn; + } + + /** + * Set the expiresOn property: The expiration of access key in unix time. + * + * @param expiresOn the expiresOn value to set. + * @return the RelayNamespaceAccessProperties object itself. + */ + public RelayNamespaceAccessProperties withExpiresOn(Long expiresOn) { + this.expiresOn = expiresOn; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (namespaceName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property namespaceName in model RelayNamespaceAccessProperties")); + } + if (namespaceNameSuffix() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property namespaceNameSuffix in model RelayNamespaceAccessProperties")); + } + if (hybridConnectionName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property hybridConnectionName in model RelayNamespaceAccessProperties")); + } + } +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/package-info.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/package-info.java new file mode 100644 index 000000000000..e0beea14383c --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/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 HybridConnectivityManagementApi. REST API for Hybrid Connectivity. */ +package com.azure.resourcemanager.hybridconnectivity.fluent.models; diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/package-info.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/package-info.java new file mode 100644 index 000000000000..4ba47a2bbe94 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/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 HybridConnectivityManagementApi. REST API for Hybrid Connectivity. */ +package com.azure.resourcemanager.hybridconnectivity.fluent; diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/EndpointAccessResourceImpl.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/EndpointAccessResourceImpl.java new file mode 100644 index 000000000000..720294f0aa93 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/EndpointAccessResourceImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.implementation; + +import com.azure.resourcemanager.hybridconnectivity.fluent.models.EndpointAccessResourceInner; +import com.azure.resourcemanager.hybridconnectivity.models.EndpointAccessResource; + +public final class EndpointAccessResourceImpl implements EndpointAccessResource { + private EndpointAccessResourceInner innerObject; + + private final com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager serviceManager; + + EndpointAccessResourceImpl( + EndpointAccessResourceInner innerObject, + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String namespaceName() { + return this.innerModel().namespaceName(); + } + + public String namespaceNameSuffix() { + return this.innerModel().namespaceNameSuffix(); + } + + public String hybridConnectionName() { + return this.innerModel().hybridConnectionName(); + } + + public String accessKey() { + return this.innerModel().accessKey(); + } + + public Long expiresOn() { + return this.innerModel().expiresOn(); + } + + public EndpointAccessResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/EndpointResourceImpl.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/EndpointResourceImpl.java new file mode 100644 index 000000000000..1f5c4236385a --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/EndpointResourceImpl.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.hybridconnectivity.fluent.models.EndpointResourceInner; +import com.azure.resourcemanager.hybridconnectivity.models.EndpointAccessResource; +import com.azure.resourcemanager.hybridconnectivity.models.EndpointResource; +import com.azure.resourcemanager.hybridconnectivity.models.Type; + +public final class EndpointResourceImpl + implements EndpointResource, EndpointResource.Definition, EndpointResource.Update { + private EndpointResourceInner innerObject; + + private final com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Type typePropertiesType() { + return this.innerModel().typePropertiesType(); + } + + public String resourceId() { + return this.innerModel().resourceId(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public EndpointResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager() { + return this.serviceManager; + } + + private String resourceUri; + + private String endpointName; + + public EndpointResourceImpl withExistingResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + return this; + } + + public EndpointResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getEndpoints() + .createOrUpdateWithResponse(resourceUri, endpointName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public EndpointResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getEndpoints() + .createOrUpdateWithResponse(resourceUri, endpointName, this.innerModel(), context) + .getValue(); + return this; + } + + EndpointResourceImpl( + String name, com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager serviceManager) { + this.innerObject = new EndpointResourceInner(); + this.serviceManager = serviceManager; + this.endpointName = name; + } + + public EndpointResourceImpl update() { + return this; + } + + public EndpointResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getEndpoints() + .updateWithResponse(resourceUri, endpointName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public EndpointResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getEndpoints() + .updateWithResponse(resourceUri, endpointName, this.innerModel(), context) + .getValue(); + return this; + } + + EndpointResourceImpl( + EndpointResourceInner innerObject, + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceUri = + Utils + .getValueFromIdByParameterName( + innerObject.id(), + "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}", + "resourceUri"); + this.endpointName = + Utils + .getValueFromIdByParameterName( + innerObject.id(), + "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}", + "endpointName"); + } + + public EndpointResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getEndpoints() + .getWithResponse(resourceUri, endpointName, Context.NONE) + .getValue(); + return this; + } + + public EndpointResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getEndpoints() + .getWithResponse(resourceUri, endpointName, context) + .getValue(); + return this; + } + + public EndpointAccessResource listCredentials() { + return serviceManager.endpoints().listCredentials(resourceUri, endpointName); + } + + public Response listCredentialsWithResponse(Long expiresin, Context context) { + return serviceManager.endpoints().listCredentialsWithResponse(resourceUri, endpointName, expiresin, context); + } + + public EndpointResourceImpl withTypePropertiesType(Type typePropertiesType) { + this.innerModel().withTypePropertiesType(typePropertiesType); + return this; + } + + public EndpointResourceImpl withResourceId(String resourceId) { + this.innerModel().withResourceId(resourceId); + return this; + } +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/EndpointsClientImpl.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/EndpointsClientImpl.java new file mode 100644 index 000000000000..fdbf2290e42a --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/EndpointsClientImpl.java @@ -0,0 +1,1068 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.hybridconnectivity.fluent.EndpointsClient; +import com.azure.resourcemanager.hybridconnectivity.fluent.models.EndpointAccessResourceInner; +import com.azure.resourcemanager.hybridconnectivity.fluent.models.EndpointResourceInner; +import com.azure.resourcemanager.hybridconnectivity.models.EndpointsList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in EndpointsClient. */ +public final class EndpointsClientImpl implements EndpointsClient { + private final ClientLogger logger = new ClientLogger(EndpointsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final EndpointsService service; + + /** The service client containing this operation class. */ + private final HybridConnectivityManagementApiImpl client; + + /** + * Initializes an instance of EndpointsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EndpointsClientImpl(HybridConnectivityManagementApiImpl client) { + this.service = + RestProxy.create(EndpointsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for HybridConnectivityManagementApiEndpoints to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "HybridConnectivityMa") + private interface EndpointsService { + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam(value = "endpointName", encoded = true) String endpointName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam(value = "endpointName", encoded = true) String endpointName, + @BodyParam("application/json") EndpointResourceInner endpointResource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch("/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam(value = "endpointName", encoded = true) String endpointName, + @BodyParam("application/json") EndpointResourceInner endpointResource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam(value = "endpointName", encoded = true) String endpointName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listCredentials") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listCredentials( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam(value = "endpointName", encoded = true) String endpointName, + @QueryParam("expiresin") Long expiresin, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List of endpoints to the target 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 endpoints. + */ + @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(), this.client.getApiVersion(), resourceUri, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List of endpoints to the target 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 endpoints. + */ + @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(), this.client.getApiVersion(), resourceUri, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List of endpoints to the target 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 endpoints. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceUri), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List of endpoints to the target 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 endpoints. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceUri, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List of endpoints to the target 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 endpoints. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri) { + return new PagedIterable<>(listAsync(resourceUri)); + } + + /** + * List of endpoints to the target 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 endpoints. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri, Context context) { + return new PagedIterable<>(listAsync(resourceUri, context)); + } + + /** + * Gets the endpoint to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint to the resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceUri, String endpointName) { + 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 (endpointName == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceUri, + endpointName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the endpoint to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint to the resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceUri, String endpointName, 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 (endpointName == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, endpointName, accept, context); + } + + /** + * Gets the endpoint to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint to the resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceUri, String endpointName) { + return getWithResponseAsync(resourceUri, endpointName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the endpoint to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint to the resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EndpointResourceInner get(String resourceUri, String endpointName) { + return getAsync(resourceUri, endpointName).block(); + } + + /** + * Gets the endpoint to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint to the resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceUri, String endpointName, Context context) { + return getWithResponseAsync(resourceUri, endpointName, context).block(); + } + + /** + * Create or update the endpoint to the target resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param endpointResource Endpoint 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 endpoint for the target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceUri, String endpointName, EndpointResourceInner endpointResource) { + 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 (endpointName == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointName is required and cannot be null.")); + } + if (endpointResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter endpointResource is required and cannot be null.")); + } else { + endpointResource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceUri, + endpointName, + endpointResource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update the endpoint to the target resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param endpointResource Endpoint 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 endpoint for the target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceUri, String endpointName, EndpointResourceInner endpointResource, 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 (endpointName == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointName is required and cannot be null.")); + } + if (endpointResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter endpointResource is required and cannot be null.")); + } else { + endpointResource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceUri, + endpointName, + endpointResource, + accept, + context); + } + + /** + * Create or update the endpoint to the target resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param endpointResource Endpoint 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 endpoint for the target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceUri, String endpointName, EndpointResourceInner endpointResource) { + return createOrUpdateWithResponseAsync(resourceUri, endpointName, endpointResource) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update the endpoint to the target resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param endpointResource Endpoint 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 endpoint for the target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EndpointResourceInner createOrUpdate( + String resourceUri, String endpointName, EndpointResourceInner endpointResource) { + return createOrUpdateAsync(resourceUri, endpointName, endpointResource).block(); + } + + /** + * Create or update the endpoint to the target resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param endpointResource Endpoint 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 endpoint for the target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceUri, String endpointName, EndpointResourceInner endpointResource, Context context) { + return createOrUpdateWithResponseAsync(resourceUri, endpointName, endpointResource, context).block(); + } + + /** + * Update the endpoint to the target resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param endpointResource Endpoint 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 endpoint for the target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceUri, String endpointName, EndpointResourceInner endpointResource) { + 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 (endpointName == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointName is required and cannot be null.")); + } + if (endpointResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter endpointResource is required and cannot be null.")); + } else { + endpointResource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceUri, + endpointName, + endpointResource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update the endpoint to the target resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param endpointResource Endpoint 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 endpoint for the target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceUri, String endpointName, EndpointResourceInner endpointResource, 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 (endpointName == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointName is required and cannot be null.")); + } + if (endpointResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter endpointResource is required and cannot be null.")); + } else { + endpointResource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceUri, + endpointName, + endpointResource, + accept, + context); + } + + /** + * Update the endpoint to the target resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param endpointResource Endpoint 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 endpoint for the target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceUri, String endpointName, EndpointResourceInner endpointResource) { + return updateWithResponseAsync(resourceUri, endpointName, endpointResource) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update the endpoint to the target resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param endpointResource Endpoint 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 endpoint for the target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EndpointResourceInner update( + String resourceUri, String endpointName, EndpointResourceInner endpointResource) { + return updateAsync(resourceUri, endpointName, endpointResource).block(); + } + + /** + * Update the endpoint to the target resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param endpointResource Endpoint 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 endpoint for the target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceUri, String endpointName, EndpointResourceInner endpointResource, Context context) { + return updateWithResponseAsync(resourceUri, endpointName, endpointResource, context).block(); + } + + /** + * Deletes the endpoint access to the target resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceUri, String endpointName) { + 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 (endpointName == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceUri, + endpointName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the endpoint access to the target resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceUri, String endpointName, 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 (endpointName == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, endpointName, accept, context); + } + + /** + * Deletes the endpoint access to the target resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceUri, String endpointName) { + return deleteWithResponseAsync(resourceUri, endpointName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes the endpoint access to the target resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceUri, String endpointName) { + deleteAsync(resourceUri, endpointName).block(); + } + + /** + * Deletes the endpoint access to the target resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceUri, String endpointName, Context context) { + return deleteWithResponseAsync(resourceUri, endpointName, context).block(); + } + + /** + * Gets the endpoint access credentials to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param expiresin The is how long the endpoint access token is valid (in seconds). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 endpoint access credentials to the resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCredentialsWithResponseAsync( + String resourceUri, String endpointName, Long expiresin) { + 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 (endpointName == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listCredentials( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceUri, + endpointName, + expiresin, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the endpoint access credentials to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param expiresin The is how long the endpoint access token is valid (in seconds). + * @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 endpoint access credentials to the resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCredentialsWithResponseAsync( + String resourceUri, String endpointName, Long expiresin, 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 (endpointName == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listCredentials( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceUri, + endpointName, + expiresin, + accept, + context); + } + + /** + * Gets the endpoint access credentials to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param expiresin The is how long the endpoint access token is valid (in seconds). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 endpoint access credentials to the resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listCredentialsAsync( + String resourceUri, String endpointName, Long expiresin) { + return listCredentialsWithResponseAsync(resourceUri, endpointName, expiresin) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the endpoint access credentials to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint access credentials to the resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listCredentialsAsync(String resourceUri, String endpointName) { + final Long expiresin = null; + return listCredentialsWithResponseAsync(resourceUri, endpointName, expiresin) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the endpoint access credentials to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint access credentials to the resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EndpointAccessResourceInner listCredentials(String resourceUri, String endpointName) { + final Long expiresin = null; + return listCredentialsAsync(resourceUri, endpointName, expiresin).block(); + } + + /** + * Gets the endpoint access credentials to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param expiresin The is how long the endpoint access token is valid (in seconds). + * @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 endpoint access credentials to the resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listCredentialsWithResponse( + String resourceUri, String endpointName, Long expiresin, Context context) { + return listCredentialsWithResponseAsync(resourceUri, endpointName, expiresin, 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 endpoints. + */ + @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 endpoints. + */ + @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/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/EndpointsImpl.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/EndpointsImpl.java new file mode 100644 index 000000000000..a5047335a219 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/EndpointsImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.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.hybridconnectivity.fluent.EndpointsClient; +import com.azure.resourcemanager.hybridconnectivity.fluent.models.EndpointAccessResourceInner; +import com.azure.resourcemanager.hybridconnectivity.fluent.models.EndpointResourceInner; +import com.azure.resourcemanager.hybridconnectivity.models.EndpointAccessResource; +import com.azure.resourcemanager.hybridconnectivity.models.EndpointResource; +import com.azure.resourcemanager.hybridconnectivity.models.Endpoints; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class EndpointsImpl implements Endpoints { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EndpointsImpl.class); + + private final EndpointsClient innerClient; + + private final com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager serviceManager; + + public EndpointsImpl( + EndpointsClient innerClient, + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceUri) { + PagedIterable inner = this.serviceClient().list(resourceUri); + return Utils.mapPage(inner, inner1 -> new EndpointResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceUri, Context context) { + PagedIterable inner = this.serviceClient().list(resourceUri, context); + return Utils.mapPage(inner, inner1 -> new EndpointResourceImpl(inner1, this.manager())); + } + + public EndpointResource get(String resourceUri, String endpointName) { + EndpointResourceInner inner = this.serviceClient().get(resourceUri, endpointName); + if (inner != null) { + return new EndpointResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String resourceUri, String endpointName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceUri, endpointName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EndpointResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceUri, String endpointName) { + this.serviceClient().delete(resourceUri, endpointName); + } + + public Response deleteWithResponse(String resourceUri, String endpointName, Context context) { + return this.serviceClient().deleteWithResponse(resourceUri, endpointName, context); + } + + public EndpointAccessResource listCredentials(String resourceUri, String endpointName) { + EndpointAccessResourceInner inner = this.serviceClient().listCredentials(resourceUri, endpointName); + if (inner != null) { + return new EndpointAccessResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listCredentialsWithResponse( + String resourceUri, String endpointName, Long expiresin, Context context) { + Response inner = + this.serviceClient().listCredentialsWithResponse(resourceUri, endpointName, expiresin, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EndpointAccessResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public EndpointResource getById(String id) { + String resourceUri = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}", + "resourceUri"); + if (resourceUri == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String endpointName = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}", + "endpointName"); + if (endpointName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'endpoints'.", id))); + } + return this.getWithResponse(resourceUri, endpointName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceUri = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}", + "resourceUri"); + if (resourceUri == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String endpointName = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}", + "endpointName"); + if (endpointName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'endpoints'.", id))); + } + return this.getWithResponse(resourceUri, endpointName, context); + } + + public void deleteById(String id) { + String resourceUri = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}", + "resourceUri"); + if (resourceUri == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String endpointName = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}", + "endpointName"); + if (endpointName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'endpoints'.", id))); + } + this.deleteWithResponse(resourceUri, endpointName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceUri = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}", + "resourceUri"); + if (resourceUri == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String endpointName = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}", + "endpointName"); + if (endpointName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'endpoints'.", id))); + } + return this.deleteWithResponse(resourceUri, endpointName, context); + } + + private EndpointsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager() { + return this.serviceManager; + } + + public EndpointResourceImpl define(String name) { + return new EndpointResourceImpl(name, this.manager()); + } +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/HybridConnectivityManagementApiBuilder.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/HybridConnectivityManagementApiBuilder.java new file mode 100644 index 000000000000..85eed7c46432 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/HybridConnectivityManagementApiBuilder.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.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 HybridConnectivityManagementApiImpl type. */ +@ServiceClientBuilder(serviceClients = {HybridConnectivityManagementApiImpl.class}) +public final class HybridConnectivityManagementApiBuilder { + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the HybridConnectivityManagementApiBuilder. + */ + public HybridConnectivityManagementApiBuilder 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 HybridConnectivityManagementApiBuilder. + */ + public HybridConnectivityManagementApiBuilder 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 HybridConnectivityManagementApiBuilder. + */ + public HybridConnectivityManagementApiBuilder 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 HybridConnectivityManagementApiBuilder. + */ + public HybridConnectivityManagementApiBuilder 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 HybridConnectivityManagementApiBuilder. + */ + public HybridConnectivityManagementApiBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of HybridConnectivityManagementApiImpl with the provided parameters. + * + * @return an instance of HybridConnectivityManagementApiImpl. + */ + public HybridConnectivityManagementApiImpl 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(); + } + HybridConnectivityManagementApiImpl client = + new HybridConnectivityManagementApiImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, endpoint); + return client; + } +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/HybridConnectivityManagementApiImpl.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/HybridConnectivityManagementApiImpl.java new file mode 100644 index 000000000000..ff5baffd11f8 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/HybridConnectivityManagementApiImpl.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.hybridconnectivity.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.hybridconnectivity.fluent.EndpointsClient; +import com.azure.resourcemanager.hybridconnectivity.fluent.HybridConnectivityManagementApi; +import com.azure.resourcemanager.hybridconnectivity.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 HybridConnectivityManagementApiImpl type. */ +@ServiceClient(builder = HybridConnectivityManagementApiBuilder.class) +public final class HybridConnectivityManagementApiImpl implements HybridConnectivityManagementApi { + private final ClientLogger logger = new ClientLogger(HybridConnectivityManagementApiImpl.class); + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The EndpointsClient object to access its operations. */ + private final EndpointsClient endpoints; + + /** + * Gets the EndpointsClient object to access its operations. + * + * @return the EndpointsClient object. + */ + public EndpointsClient getEndpoints() { + return this.endpoints; + } + + /** + * Initializes an instance of HybridConnectivityManagementApi 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. + */ + HybridConnectivityManagementApiImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.apiVersion = "2021-10-06-preview"; + this.operations = new OperationsClientImpl(this); + this.endpoints = new EndpointsClientImpl(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)); + } + } +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/OperationImpl.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/OperationImpl.java new file mode 100644 index 000000000000..fa20ee203fc5 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/OperationImpl.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.hybridconnectivity.implementation; + +import com.azure.resourcemanager.hybridconnectivity.fluent.models.OperationInner; +import com.azure.resourcemanager.hybridconnectivity.models.ActionType; +import com.azure.resourcemanager.hybridconnectivity.models.Operation; +import com.azure.resourcemanager.hybridconnectivity.models.OperationDisplay; +import com.azure.resourcemanager.hybridconnectivity.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager serviceManager; + + OperationImpl( + OperationInner innerObject, + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager 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.hybridconnectivity.HybridConnectivityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/OperationsClientImpl.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..37c3df544e9c --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/OperationsClientImpl.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.hybridconnectivity.fluent.OperationsClient; +import com.azure.resourcemanager.hybridconnectivity.fluent.models.OperationInner; +import com.azure.resourcemanager.hybridconnectivity.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 { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final HybridConnectivityManagementApiImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(HybridConnectivityManagementApiImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for HybridConnectivityManagementApiOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "HybridConnectivityMa") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.HybridConnectivity/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 Hybrid Connectivity 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. + */ + @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 Hybrid Connectivity 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. + */ + @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 Hybrid Connectivity 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the available Hybrid Connectivity 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the available Hybrid Connectivity 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists the available Hybrid Connectivity 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. + */ + @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. + */ + @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. + */ + @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/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/OperationsImpl.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/OperationsImpl.java new file mode 100644 index 000000000000..5b30ccd11703 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/OperationsImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.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.hybridconnectivity.fluent.OperationsClient; +import com.azure.resourcemanager.hybridconnectivity.fluent.models.OperationInner; +import com.azure.resourcemanager.hybridconnectivity.models.Operation; +import com.azure.resourcemanager.hybridconnectivity.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager 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.hybridconnectivity.HybridConnectivityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/Utils.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/Utils.java new file mode 100644 index 000000000000..67ba7576f3d1 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/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.hybridconnectivity.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/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/package-info.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/package-info.java new file mode 100644 index 000000000000..56225f0e4e23 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/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 HybridConnectivityManagementApi. REST API for Hybrid Connectivity. */ +package com.azure.resourcemanager.hybridconnectivity.implementation; diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/ActionType.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/ActionType.java new file mode 100644 index 000000000000..1201b1584089 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/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.hybridconnectivity.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/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/EndpointAccessResource.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/EndpointAccessResource.java new file mode 100644 index 000000000000..54303ea23bee --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/EndpointAccessResource.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.hybridconnectivity.models; + +import com.azure.resourcemanager.hybridconnectivity.fluent.models.EndpointAccessResourceInner; + +/** An immutable client-side representation of EndpointAccessResource. */ +public interface EndpointAccessResource { + /** + * Gets the namespaceName property: The namespace name. + * + * @return the namespaceName value. + */ + String namespaceName(); + + /** + * Gets the namespaceNameSuffix property: The suffix domain name of relay namespace. + * + * @return the namespaceNameSuffix value. + */ + String namespaceNameSuffix(); + + /** + * Gets the hybridConnectionName property: Azure Relay hybrid connection name for the resource. + * + * @return the hybridConnectionName value. + */ + String hybridConnectionName(); + + /** + * Gets the accessKey property: Access key for hybrid connection. + * + * @return the accessKey value. + */ + String accessKey(); + + /** + * Gets the expiresOn property: The expiration of access key in unix time. + * + * @return the expiresOn value. + */ + Long expiresOn(); + + /** + * Gets the inner com.azure.resourcemanager.hybridconnectivity.fluent.models.EndpointAccessResourceInner object. + * + * @return the inner object. + */ + EndpointAccessResourceInner innerModel(); +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/EndpointResource.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/EndpointResource.java new file mode 100644 index 000000000000..147c91f1fe72 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/EndpointResource.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.hybridconnectivity.fluent.models.EndpointResourceInner; + +/** An immutable client-side representation of EndpointResource. */ +public interface EndpointResource { + /** + * 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 typePropertiesType property: The type of endpoint. + * + * @return the typePropertiesType value. + */ + Type typePropertiesType(); + + /** + * Gets the resourceId property: The resource Id of the connectivity endpoint (optional). + * + * @return the resourceId value. + */ + String resourceId(); + + /** + * Gets the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.hybridconnectivity.fluent.models.EndpointResourceInner object. + * + * @return the inner object. + */ + EndpointResourceInner innerModel(); + + /** The entirety of the EndpointResource definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + /** The EndpointResource definition stages. */ + interface DefinitionStages { + /** The first stage of the EndpointResource definition. */ + interface Blank extends WithScope { + } + /** The stage of the EndpointResource definition allowing to specify parent resource. */ + interface WithScope { + /** + * 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 EndpointResource 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.WithTypePropertiesType, DefinitionStages.WithResourceId { + /** + * Executes the create request. + * + * @return the created resource. + */ + EndpointResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + EndpointResource create(Context context); + } + /** The stage of the EndpointResource definition allowing to specify typePropertiesType. */ + interface WithTypePropertiesType { + /** + * Specifies the typePropertiesType property: The type of endpoint.. + * + * @param typePropertiesType The type of endpoint. + * @return the next definition stage. + */ + WithCreate withTypePropertiesType(Type typePropertiesType); + } + /** The stage of the EndpointResource definition allowing to specify resourceId. */ + interface WithResourceId { + /** + * Specifies the resourceId property: The resource Id of the connectivity endpoint (optional).. + * + * @param resourceId The resource Id of the connectivity endpoint (optional). + * @return the next definition stage. + */ + WithCreate withResourceId(String resourceId); + } + } + /** + * Begins update for the EndpointResource resource. + * + * @return the stage of resource update. + */ + EndpointResource.Update update(); + + /** The template for EndpointResource update. */ + interface Update extends UpdateStages.WithTypePropertiesType, UpdateStages.WithResourceId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + EndpointResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + EndpointResource apply(Context context); + } + /** The EndpointResource update stages. */ + interface UpdateStages { + /** The stage of the EndpointResource update allowing to specify typePropertiesType. */ + interface WithTypePropertiesType { + /** + * Specifies the typePropertiesType property: The type of endpoint.. + * + * @param typePropertiesType The type of endpoint. + * @return the next definition stage. + */ + Update withTypePropertiesType(Type typePropertiesType); + } + /** The stage of the EndpointResource update allowing to specify resourceId. */ + interface WithResourceId { + /** + * Specifies the resourceId property: The resource Id of the connectivity endpoint (optional).. + * + * @param resourceId The resource Id of the connectivity endpoint (optional). + * @return the next definition stage. + */ + Update withResourceId(String resourceId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + EndpointResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + EndpointResource refresh(Context context); + + /** + * Gets the endpoint access credentials to the resource. + * + * @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 endpoint access credentials to the resource. + */ + EndpointAccessResource listCredentials(); + + /** + * Gets the endpoint access credentials to the resource. + * + * @param expiresin The is how long the endpoint access token is valid (in seconds). + * @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 endpoint access credentials to the resource. + */ + Response listCredentialsWithResponse(Long expiresin, Context context); +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/Endpoints.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/Endpoints.java new file mode 100644 index 000000000000..2c0dd4072ef9 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/Endpoints.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.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 Endpoints. */ +public interface Endpoints { + /** + * List of endpoints to the target 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 endpoints. + */ + PagedIterable list(String resourceUri); + + /** + * List of endpoints to the target 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 endpoints. + */ + PagedIterable list(String resourceUri, Context context); + + /** + * Gets the endpoint to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint to the resource. + */ + EndpointResource get(String resourceUri, String endpointName); + + /** + * Gets the endpoint to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint to the resource. + */ + Response getWithResponse(String resourceUri, String endpointName, Context context); + + /** + * Deletes the endpoint access to the target resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceUri, String endpointName); + + /** + * Deletes the endpoint access to the target resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String resourceUri, String endpointName, Context context); + + /** + * Gets the endpoint access credentials to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint access credentials to the resource. + */ + EndpointAccessResource listCredentials(String resourceUri, String endpointName); + + /** + * Gets the endpoint access credentials to the resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param expiresin The is how long the endpoint access token is valid (in seconds). + * @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 endpoint access credentials to the resource. + */ + Response listCredentialsWithResponse( + String resourceUri, String endpointName, Long expiresin, Context context); + + /** + * Gets the endpoint to the resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint to the resource. + */ + EndpointResource getById(String id); + + /** + * Gets the endpoint to the resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the endpoint to the resource. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the endpoint access to the target resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the endpoint access to the target resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new EndpointResource resource. + * + * @param name resource name. + * @return the first stage of the new EndpointResource definition. + */ + EndpointResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/EndpointsList.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/EndpointsList.java new file mode 100644 index 000000000000..6795dcdabf2f --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/EndpointsList.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.hybridconnectivity.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.hybridconnectivity.fluent.models.EndpointResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of endpoints. */ +@Fluent +public final class EndpointsList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EndpointsList.class); + + /* + * The link used to get the next page of endpoints list. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * The list of endpoint. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the nextLink property: The link used to get the next page of endpoints list. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of endpoints list. + * + * @param nextLink the nextLink value to set. + * @return the EndpointsList object itself. + */ + public EndpointsList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: The list of endpoint. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of endpoint. + * + * @param value the value value to set. + * @return the EndpointsList object itself. + */ + public EndpointsList 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/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/Operation.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/Operation.java new file mode 100644 index 000000000000..86770b9a4859 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/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.hybridconnectivity.models; + +import com.azure.resourcemanager.hybridconnectivity.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.hybridconnectivity.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/OperationDisplay.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/OperationDisplay.java new file mode 100644 index 000000000000..1a5e44d9e076 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/OperationDisplay.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Localized display information for this particular operation. */ +@Immutable +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * 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/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/OperationListResult.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/OperationListResult.java new file mode 100644 index 000000000000..8840b093a6f4 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/OperationListResult.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.hybridconnectivity.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * 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/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/Operations.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/Operations.java new file mode 100644 index 000000000000..9b60b4fcbeb1 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/Operations.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.hybridconnectivity.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 Hybrid Connectivity 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. + */ + PagedIterable list(); + + /** + * Lists the available Hybrid Connectivity 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. + */ + PagedIterable list(Context context); +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/Origin.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/Origin.java new file mode 100644 index 000000000000..ed7b6e05706f --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/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.hybridconnectivity.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/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/Type.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/Type.java new file mode 100644 index 000000000000..03d1e4e14d84 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/Type.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.hybridconnectivity.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 default for Type. */ + public static final Type DEFAULT = fromString("default"); + + /** Static value custom for Type. */ + public static final Type CUSTOM = fromString("custom"); + + /** + * 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/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/package-info.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/package-info.java new file mode 100644 index 000000000000..3b64be2b13f7 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/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 HybridConnectivityManagementApi. REST API for Hybrid Connectivity. */ +package com.azure.resourcemanager.hybridconnectivity.models; diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/package-info.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/package-info.java new file mode 100644 index 000000000000..770d2e1ec189 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/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 HybridConnectivityManagementApi. REST API for Hybrid Connectivity. */ +package com.azure.resourcemanager.hybridconnectivity; diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/module-info.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/module-info.java new file mode 100644 index 000000000000..1743edc925dc --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/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.hybridconnectivity { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.hybridconnectivity; + exports com.azure.resourcemanager.hybridconnectivity.fluent; + exports com.azure.resourcemanager.hybridconnectivity.fluent.models; + exports com.azure.resourcemanager.hybridconnectivity.models; + + opens com.azure.resourcemanager.hybridconnectivity.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.hybridconnectivity.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsCreateOrUpdateSamples.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..bf8643f8f003 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsCreateOrUpdateSamples.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.generated; + +import com.azure.resourcemanager.hybridconnectivity.models.Type; + +/** Samples for Endpoints CreateOrUpdate. */ +public final class EndpointsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsPutCustom.json + */ + /** + * Sample code: HybridConnectivityEndpointsPutCustom. + * + * @param manager Entry point to HybridConnectivityManager. + */ + public static void hybridConnectivityEndpointsPutCustom( + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager) { + manager + .endpoints() + .define("custom") + .withExistingResourceUri( + "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine") + .withTypePropertiesType(Type.CUSTOM) + .withResourceId( + "/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.Relay/namespaces/custom-relay-namespace") + .create(); + } + + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsPutDefault.json + */ + /** + * Sample code: HybridConnectivityEndpointsPutDefault. + * + * @param manager Entry point to HybridConnectivityManager. + */ + public static void hybridConnectivityEndpointsPutDefault( + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager) { + manager + .endpoints() + .define("default") + .withExistingResourceUri( + "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine") + .withTypePropertiesType(Type.DEFAULT) + .create(); + } +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsDeleteSamples.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsDeleteSamples.java new file mode 100644 index 000000000000..7ee605f4e18a --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsDeleteSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.generated; + +import com.azure.core.util.Context; + +/** Samples for Endpoints Delete. */ +public final class EndpointsDeleteSamples { + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsDeleteDefault.json + */ + /** + * Sample code: HybridConnectivityEndpointsDeleteDefault. + * + * @param manager Entry point to HybridConnectivityManager. + */ + public static void hybridConnectivityEndpointsDeleteDefault( + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager) { + manager + .endpoints() + .deleteWithResponse( + "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", + "default", + Context.NONE); + } +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsGetSamples.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsGetSamples.java new file mode 100644 index 000000000000..7d291c032abe --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsGetSamples.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.hybridconnectivity.generated; + +import com.azure.core.util.Context; + +/** Samples for Endpoints Get. */ +public final class EndpointsGetSamples { + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsGetDefault.json + */ + /** + * Sample code: HybridConnectivityEndpointsGetDefault. + * + * @param manager Entry point to HybridConnectivityManager. + */ + public static void hybridConnectivityEndpointsGetDefault( + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager) { + manager + .endpoints() + .getWithResponse( + "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", + "default", + Context.NONE); + } + + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsGetCustom.json + */ + /** + * Sample code: HybridConnectivityEndpointsGetCustom. + * + * @param manager Entry point to HybridConnectivityManager. + */ + public static void hybridConnectivityEndpointsGetCustom( + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager) { + manager + .endpoints() + .getWithResponse( + "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", + "custom", + Context.NONE); + } +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsListCredentialsSamples.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsListCredentialsSamples.java new file mode 100644 index 000000000000..a408b4edde73 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsListCredentialsSamples.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.hybridconnectivity.generated; + +import com.azure.core.util.Context; + +/** Samples for Endpoints ListCredentials. */ +public final class EndpointsListCredentialsSamples { + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsPostListCredentials.json + */ + /** + * Sample code: HybridConnectivityEndpointsPostListCredentials. + * + * @param manager Entry point to HybridConnectivityManager. + */ + public static void hybridConnectivityEndpointsPostListCredentials( + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager) { + manager + .endpoints() + .listCredentialsWithResponse( + "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", + "default", + 10800L, + Context.NONE); + } +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsListSamples.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsListSamples.java new file mode 100644 index 000000000000..87e477bfe75e --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsListSamples.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.hybridconnectivity.generated; + +import com.azure.core.util.Context; + +/** Samples for Endpoints List. */ +public final class EndpointsListSamples { + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsList.json + */ + /** + * Sample code: HybridConnectivityEndpointsGet. + * + * @param manager Entry point to HybridConnectivityManager. + */ + public static void hybridConnectivityEndpointsGet( + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager) { + manager + .endpoints() + .list( + "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", + Context.NONE); + } +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsUpdateSamples.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsUpdateSamples.java new file mode 100644 index 000000000000..88cb80302e34 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsUpdateSamples.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.hybridconnectivity.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.hybridconnectivity.models.EndpointResource; +import com.azure.resourcemanager.hybridconnectivity.models.Type; + +/** Samples for Endpoints Update. */ +public final class EndpointsUpdateSamples { + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsPatchDefault.json + */ + /** + * Sample code: HybridConnectivityEndpointsPatchDefault. + * + * @param manager Entry point to HybridConnectivityManager. + */ + public static void hybridConnectivityEndpointsPatchDefault( + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager) { + EndpointResource resource = + manager + .endpoints() + .getWithResponse( + "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", + "default", + Context.NONE) + .getValue(); + resource.update().withTypePropertiesType(Type.DEFAULT).apply(); + } +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/OperationsListSamples.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/OperationsListSamples.java new file mode 100644 index 000000000000..502f54ee8037 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/OperationsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/OperationsList.json + */ + /** + * Sample code: HybridConnectivityOperationsList. + * + * @param manager Entry point to HybridConnectivityManager. + */ + public static void hybridConnectivityOperationsList( + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager) { + manager.operations().list(Context.NONE); + } +} diff --git a/sdk/hybridconnectivity/ci.yml b/sdk/hybridconnectivity/ci.yml new file mode 100644 index 000000000000..eb7d1e29bf5a --- /dev/null +++ b/sdk/hybridconnectivity/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/hybridconnectivity/ci.yml + - sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/ + exclude: + - sdk/hybridconnectivity/pom.xml + - sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hybridconnectivity/ci.yml + - sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/ + exclude: + - sdk/hybridconnectivity/pom.xml + - sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/pom.xml + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: hybridconnectivity + Artifacts: + - name: azure-resourcemanager-hybridconnectivity + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerhybridconnectivity diff --git a/sdk/hybridconnectivity/pom.xml b/sdk/hybridconnectivity/pom.xml new file mode 100644 index 000000000000..c3f81d42946a --- /dev/null +++ b/sdk/hybridconnectivity/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-hybridconnectivity-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-hybridconnectivity + + + +