diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index c8b8d8ee0dc3..3d18510f52d3 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -388,6 +388,7 @@ com.azure.resourcemanager:azure-resourcemanager-elasticsan;1.0.0-beta.1;1.0.0-be com.azure.resourcemanager:azure-resourcemanager-hybridcontainerservice;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-securitydevops;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-appcomplianceautomation;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-hybridconnectivity;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index a261806d8ce1..878299e2f304 100644 --- a/pom.xml +++ b/pom.xml @@ -87,6 +87,7 @@ sdk/healthbot sdk/healthcareapis sdk/hybridcompute + sdk/hybridconnectivity sdk/hybridcontainerservice sdk/hybridkubernetes sdk/hybridnetwork diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/CHANGELOG.md b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/CHANGELOG.md new file mode 100644 index 000000000000..c291717703a6 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-12-13) + +- 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-2023-03-15. 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..98c59bd38d73 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/README.md @@ -0,0 +1,105 @@ +# 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-2023-03-15. 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] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configuration of the 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 `AZURE_SUBSCRIPTION_ID` environment variable. + +With above configuration, `azure` client can be authenticated using the 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][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://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 +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/SAMPLE.md b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/SAMPLE.md new file mode 100644 index 000000000000..6a001c17cfcd --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/SAMPLE.md @@ -0,0 +1,318 @@ +# Code snippets and samples + + +## Endpoints + +- [CreateOrUpdate](#endpoints_createorupdate) +- [Delete](#endpoints_delete) +- [Get](#endpoints_get) +- [List](#endpoints_list) +- [ListCredentials](#endpoints_listcredentials) +- [ListIngressGatewayCredentials](#endpoints_listingressgatewaycredentials) +- [ListManagedProxyDetails](#endpoints_listmanagedproxydetails) +- [Update](#endpoints_update) + +## Operations + +- [List](#operations_list) +### Endpoints_CreateOrUpdate + +```java +import com.azure.resourcemanager.hybridconnectivity.models.ServiceConfiguration; +import com.azure.resourcemanager.hybridconnectivity.models.ServiceName; +import com.azure.resourcemanager.hybridconnectivity.models.Type; +import java.util.Arrays; + +/** Samples for Endpoints CreateOrUpdate. */ +public final class EndpointsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/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/stable/2023-03-15/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) + .withServiceConfigurations( + Arrays + .asList( + new ServiceConfiguration().withServiceName(ServiceName.SSH).withPort("22"), + new ServiceConfiguration().withServiceName(ServiceName.WAC).withPort("80"))) + .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/stable/2023-03-15/examples/EndpointsDeleteDefault.json + */ + /** + * Sample code: HybridConnectivityEndpointsDeleteDefault. + * + * @param manager Entry point to HybridConnectivityManager. + */ + public static void hybridConnectivityEndpointsDeleteDefault( + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager) { + manager + .endpoints() + .deleteByResourceGroupWithResponse( + "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/stable/2023-03-15/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/stable/2023-03-15/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/stable/2023-03-15/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; +import com.azure.resourcemanager.hybridconnectivity.models.ListCredentialsRequest; +import com.azure.resourcemanager.hybridconnectivity.models.ServiceName; + +/** Samples for Endpoints ListCredentials. */ +public final class EndpointsListCredentialsSamples { + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/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, + new ListCredentialsRequest().withServiceName(ServiceName.SSH), + Context.NONE); + } +} +``` + +### Endpoints_ListIngressGatewayCredentials + +```java +import com.azure.core.util.Context; + +/** Samples for Endpoints ListIngressGatewayCredentials. */ +public final class EndpointsListIngressGatewayCredentialsSamples { + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsPostListIngressGatewayCredentials.json + */ + /** + * Sample code: HybridConnectivityEndpointsPostListIngressGatewayCredentials. + * + * @param manager Entry point to HybridConnectivityManager. + */ + public static void hybridConnectivityEndpointsPostListIngressGatewayCredentials( + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager) { + manager + .endpoints() + .listIngressGatewayCredentialsWithResponse( + "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/arcGroup/providers/Microsoft.ArcPlaceHolder/ProvisionedClusters/cluster0", + "default", + 10800L, + Context.NONE); + } +} +``` + +### Endpoints_ListManagedProxyDetails + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.hybridconnectivity.models.ManagedProxyRequest; +import com.azure.resourcemanager.hybridconnectivity.models.ServiceName; + +/** Samples for Endpoints ListManagedProxyDetails. */ +public final class EndpointsListManagedProxyDetailsSamples { + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsPostListManagedProxyDetails.json + */ + /** + * Sample code: HybridConnectivityEndpointsPostListManagedProxyDetails. + * + * @param manager Entry point to HybridConnectivityManager. + */ + public static void hybridConnectivityEndpointsPostListManagedProxyDetails( + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager) { + manager + .endpoints() + .listManagedProxyDetailsWithResponse( + "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/arcGroup/providers/Microsoft.Compute/virtualMachines/vm00006", + "default", + new ManagedProxyRequest() + .withService("127.0.0.1:65035") + .withHostname("r.proxy.arc.com") + .withServiceName(ServiceName.WAC), + 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/stable/2023-03-15/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/stable/2023-03-15/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..2f101024677d --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/pom.xml @@ -0,0 +1,55 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-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-2023-03-15. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + true + + + + com.azure + azure-core + 1.34.0 + + + com.azure + azure-core-management + 1.9.0 + + + 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..33c7f9dab7a1 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/HybridConnectivityManager.java @@ -0,0 +1,297 @@ +// 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.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.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; +import java.util.stream.Collectors; + +/** 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); + } + + /** + * Creates an instance of HybridConnectivity service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the HybridConnectivity service API instance. + */ + public static HybridConnectivityManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new HybridConnectivityManager(httpPipeline, profile, null); + } + + /** + * 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 static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + * + *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = + Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of 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) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new HybridConnectivityManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of Endpoints. It manages EndpointResource. + * + * @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..43824f47e6a2 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/EndpointsClient.java @@ -0,0 +1,253 @@ +// 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; +import com.azure.resourcemanager.hybridconnectivity.fluent.models.IngressGatewayResourceInner; +import com.azure.resourcemanager.hybridconnectivity.fluent.models.ManagedProxyResourceInner; +import com.azure.resourcemanager.hybridconnectivity.models.ListCredentialsRequest; +import com.azure.resourcemanager.hybridconnectivity.models.ManagedProxyRequest; + +/** 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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. + * @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceUri, String endpointName, 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); + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceUri, String endpointName, EndpointResourceInner endpointResource, 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); + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + 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); + + /** + * 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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(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 listCredentialsRequest Object of type ListCredentialsRequest. + * @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listCredentialsWithResponse( + String resourceUri, + String endpointName, + Long expiresin, + ListCredentialsRequest listCredentialsRequest, + 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 ingress gateway endpoint credentials. + * + * @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 ingress gateway endpoint credentials along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listIngressGatewayCredentialsWithResponse( + String resourceUri, String endpointName, Long expiresin, Context context); + + /** + * Gets the ingress gateway endpoint credentials. + * + * @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 ingress gateway endpoint credentials. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IngressGatewayResourceInner listIngressGatewayCredentials(String resourceUri, String endpointName); + + /** + * Fetches the managed proxy details. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param managedProxyRequest Object of type ManagedProxyRequest. + * @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 managed Proxy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listManagedProxyDetailsWithResponse( + String resourceUri, String endpointName, ManagedProxyRequest managedProxyRequest, Context context); + + /** + * Fetches the managed proxy details. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param managedProxyRequest Object of type ManagedProxyRequest. + * @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 managed Proxy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedProxyResourceInner listManagedProxyDetails( + String resourceUri, String endpointName, ManagedProxyRequest managedProxyRequest); +} 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..8d7c7b4b209d --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/OperationsClient.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 as paginated response with {@link + * PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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/AadProfileProperties.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/AadProfileProperties.java new file mode 100644 index 000000000000..114c1be42ecd --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/AadProfileProperties.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The AAD Profile. */ +@Fluent +public final class AadProfileProperties { + /* + * The arc ingress gateway server app id. + */ + @JsonProperty(value = "serverId", required = true) + private String serverId; + + /* + * The target resource home tenant id. + */ + @JsonProperty(value = "tenantId", required = true) + private String tenantId; + + /** Creates an instance of AadProfileProperties class. */ + public AadProfileProperties() { + } + + /** + * Get the serverId property: The arc ingress gateway server app id. + * + * @return the serverId value. + */ + public String serverId() { + return this.serverId; + } + + /** + * Set the serverId property: The arc ingress gateway server app id. + * + * @param serverId the serverId value to set. + * @return the AadProfileProperties object itself. + */ + public AadProfileProperties withServerId(String serverId) { + this.serverId = serverId; + return this; + } + + /** + * Get the tenantId property: The target resource home tenant id. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The target resource home tenant id. + * + * @param tenantId the tenantId value to set. + * @return the AadProfileProperties object itself. + */ + public AadProfileProperties withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serverId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property serverId in model AadProfileProperties")); + } + if (tenantId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property tenantId in model AadProfileProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AadProfileProperties.class); +} 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..a391df880c31 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/EndpointAccessResourceInner.java @@ -0,0 +1,166 @@ +// 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.fasterxml.jackson.annotation.JsonProperty; + +/** The endpoint access for the target resource. */ +@Fluent +public final class EndpointAccessResourceInner { + /* + * Azure relay hybrid connection access properties + */ + @JsonProperty(value = "relay") + private RelayNamespaceAccessProperties innerRelay; + + /** Creates an instance of EndpointAccessResourceInner class. */ + public EndpointAccessResourceInner() { + } + + /** + * 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; + } + + /** + * Get the serviceConfigurationToken property: The token to access the enabled service. + * + * @return the serviceConfigurationToken value. + */ + public String serviceConfigurationToken() { + return this.innerRelay() == null ? null : this.innerRelay().serviceConfigurationToken(); + } + + /** + * Set the serviceConfigurationToken property: The token to access the enabled service. + * + * @param serviceConfigurationToken the serviceConfigurationToken value to set. + * @return the EndpointAccessResourceInner object itself. + */ + public EndpointAccessResourceInner withServiceConfigurationToken(String serviceConfigurationToken) { + if (this.innerRelay() == null) { + this.innerRelay = new RelayNamespaceAccessProperties(); + } + this.innerRelay().withServiceConfigurationToken(serviceConfigurationToken); + 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..09f0fc977904 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/EndpointProperties.java @@ -0,0 +1,131 @@ +// 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.ServiceConfiguration; +import com.azure.resourcemanager.hybridconnectivity.models.Type; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Endpoint details. */ +@Fluent +public final class EndpointProperties { + /* + * 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 resource provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The enabled service configurations. + */ + @JsonProperty(value = "serviceConfigurations") + private List serviceConfigurations; + + /** Creates an instance of EndpointProperties class. */ + public EndpointProperties() { + } + + /** + * 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 resource provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the serviceConfigurations property: The enabled service configurations. + * + * @return the serviceConfigurations value. + */ + public List serviceConfigurations() { + return this.serviceConfigurations; + } + + /** + * Set the serviceConfigurations property: The enabled service configurations. + * + * @param serviceConfigurations the serviceConfigurations value to set. + * @return the EndpointProperties object itself. + */ + public EndpointProperties withServiceConfigurations(List serviceConfigurations) { + this.serviceConfigurations = serviceConfigurations; + return this; + } + + /** + * 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")); + } + if (serviceConfigurations() != null) { + serviceConfigurations().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EndpointProperties.class); +} 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..f8f082e2ce14 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/EndpointResourceInner.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.hybridconnectivity.models.ServiceConfiguration; +import com.azure.resourcemanager.hybridconnectivity.models.Type; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The endpoint for the target resource. */ +@Fluent +public final class EndpointResourceInner extends ProxyResource { + /* + * 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; + + /** Creates an instance of EndpointResourceInner class. */ + public EndpointResourceInner() { + } + + /** + * 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 resource provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the serviceConfigurations property: The enabled service configurations. + * + * @return the serviceConfigurations value. + */ + public List serviceConfigurations() { + return this.innerProperties() == null ? null : this.innerProperties().serviceConfigurations(); + } + + /** + * Set the serviceConfigurations property: The enabled service configurations. + * + * @param serviceConfigurations the serviceConfigurations value to set. + * @return the EndpointResourceInner object itself. + */ + public EndpointResourceInner withServiceConfigurations(List serviceConfigurations) { + if (this.innerProperties() == null) { + this.innerProperties = new EndpointProperties(); + } + this.innerProperties().withServiceConfigurations(serviceConfigurations); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/IngressGatewayResourceInner.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/IngressGatewayResourceInner.java new file mode 100644 index 000000000000..e6e5e0047b10 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/IngressGatewayResourceInner.java @@ -0,0 +1,253 @@ +// 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.fasterxml.jackson.annotation.JsonProperty; + +/** The ingress gateway access credentials. */ +@Fluent +public final class IngressGatewayResourceInner { + /* + * Azure relay hybrid connection access properties + */ + @JsonProperty(value = "relay") + private RelayNamespaceAccessProperties innerRelay; + + /* + * Ingress gateway profile + */ + @JsonProperty(value = "ingress") + private IngressProfileProperties innerIngress; + + /** Creates an instance of IngressGatewayResourceInner class. */ + public IngressGatewayResourceInner() { + } + + /** + * Get the innerRelay property: Azure relay hybrid connection access properties. + * + * @return the innerRelay value. + */ + private RelayNamespaceAccessProperties innerRelay() { + return this.innerRelay; + } + + /** + * Get the innerIngress property: Ingress gateway profile. + * + * @return the innerIngress value. + */ + private IngressProfileProperties innerIngress() { + return this.innerIngress; + } + + /** + * 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 IngressGatewayResourceInner object itself. + */ + public IngressGatewayResourceInner 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 IngressGatewayResourceInner object itself. + */ + public IngressGatewayResourceInner 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 IngressGatewayResourceInner object itself. + */ + public IngressGatewayResourceInner 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 IngressGatewayResourceInner object itself. + */ + public IngressGatewayResourceInner withExpiresOn(Long expiresOn) { + if (this.innerRelay() == null) { + this.innerRelay = new RelayNamespaceAccessProperties(); + } + this.innerRelay().withExpiresOn(expiresOn); + return this; + } + + /** + * Get the serviceConfigurationToken property: The token to access the enabled service. + * + * @return the serviceConfigurationToken value. + */ + public String serviceConfigurationToken() { + return this.innerRelay() == null ? null : this.innerRelay().serviceConfigurationToken(); + } + + /** + * Set the serviceConfigurationToken property: The token to access the enabled service. + * + * @param serviceConfigurationToken the serviceConfigurationToken value to set. + * @return the IngressGatewayResourceInner object itself. + */ + public IngressGatewayResourceInner withServiceConfigurationToken(String serviceConfigurationToken) { + if (this.innerRelay() == null) { + this.innerRelay = new RelayNamespaceAccessProperties(); + } + this.innerRelay().withServiceConfigurationToken(serviceConfigurationToken); + return this; + } + + /** + * Get the hostname property: The ingress hostname. + * + * @return the hostname value. + */ + public String hostname() { + return this.innerIngress() == null ? null : this.innerIngress().hostname(); + } + + /** + * Set the hostname property: The ingress hostname. + * + * @param hostname the hostname value to set. + * @return the IngressGatewayResourceInner object itself. + */ + public IngressGatewayResourceInner withHostname(String hostname) { + if (this.innerIngress() == null) { + this.innerIngress = new IngressProfileProperties(); + } + this.innerIngress().withHostname(hostname); + return this; + } + + /** + * Get the serverId property: The arc ingress gateway server app id. + * + * @return the serverId value. + */ + public String serverId() { + return this.innerIngress() == null ? null : this.innerIngress().serverId(); + } + + /** + * Set the serverId property: The arc ingress gateway server app id. + * + * @param serverId the serverId value to set. + * @return the IngressGatewayResourceInner object itself. + */ + public IngressGatewayResourceInner withServerId(String serverId) { + if (this.innerIngress() == null) { + this.innerIngress = new IngressProfileProperties(); + } + this.innerIngress().withServerId(serverId); + return this; + } + + /** + * Get the tenantId property: The target resource home tenant id. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerIngress() == null ? null : this.innerIngress().tenantId(); + } + + /** + * Set the tenantId property: The target resource home tenant id. + * + * @param tenantId the tenantId value to set. + * @return the IngressGatewayResourceInner object itself. + */ + public IngressGatewayResourceInner withTenantId(String tenantId) { + if (this.innerIngress() == null) { + this.innerIngress = new IngressProfileProperties(); + } + this.innerIngress().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerRelay() != null) { + innerRelay().validate(); + } + if (innerIngress() != null) { + innerIngress().validate(); + } + } +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/IngressProfileProperties.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/IngressProfileProperties.java new file mode 100644 index 000000000000..bb51af454037 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/IngressProfileProperties.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Ingress gateway profile. */ +@Fluent +public final class IngressProfileProperties { + /* + * The ingress hostname. + */ + @JsonProperty(value = "hostname", required = true) + private String hostname; + + /* + * The AAD Profile + */ + @JsonProperty(value = "aadProfile", required = true) + private AadProfileProperties innerAadProfile = new AadProfileProperties(); + + /** Creates an instance of IngressProfileProperties class. */ + public IngressProfileProperties() { + } + + /** + * Get the hostname property: The ingress hostname. + * + * @return the hostname value. + */ + public String hostname() { + return this.hostname; + } + + /** + * Set the hostname property: The ingress hostname. + * + * @param hostname the hostname value to set. + * @return the IngressProfileProperties object itself. + */ + public IngressProfileProperties withHostname(String hostname) { + this.hostname = hostname; + return this; + } + + /** + * Get the innerAadProfile property: The AAD Profile. + * + * @return the innerAadProfile value. + */ + private AadProfileProperties innerAadProfile() { + return this.innerAadProfile; + } + + /** + * Get the serverId property: The arc ingress gateway server app id. + * + * @return the serverId value. + */ + public String serverId() { + return this.innerAadProfile() == null ? null : this.innerAadProfile().serverId(); + } + + /** + * Set the serverId property: The arc ingress gateway server app id. + * + * @param serverId the serverId value to set. + * @return the IngressProfileProperties object itself. + */ + public IngressProfileProperties withServerId(String serverId) { + if (this.innerAadProfile() == null) { + this.innerAadProfile = new AadProfileProperties(); + } + this.innerAadProfile().withServerId(serverId); + return this; + } + + /** + * Get the tenantId property: The target resource home tenant id. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerAadProfile() == null ? null : this.innerAadProfile().tenantId(); + } + + /** + * Set the tenantId property: The target resource home tenant id. + * + * @param tenantId the tenantId value to set. + * @return the IngressProfileProperties object itself. + */ + public IngressProfileProperties withTenantId(String tenantId) { + if (this.innerAadProfile() == null) { + this.innerAadProfile = new AadProfileProperties(); + } + this.innerAadProfile().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (hostname() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property hostname in model IngressProfileProperties")); + } + if (innerAadProfile() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerAadProfile in model IngressProfileProperties")); + } else { + innerAadProfile().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(IngressProfileProperties.class); +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/ManagedProxyResourceInner.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/ManagedProxyResourceInner.java new file mode 100644 index 000000000000..1d667edad466 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/ManagedProxyResourceInner.java @@ -0,0 +1,84 @@ +// 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.JsonProperty; + +/** Managed Proxy. */ +@Fluent +public final class ManagedProxyResourceInner { + /* + * The short lived proxy name. + */ + @JsonProperty(value = "proxy", required = true) + private String proxy; + + /* + * The expiration time of short lived proxy name in unix epoch. + */ + @JsonProperty(value = "expiresOn", required = true) + private long expiresOn; + + /** Creates an instance of ManagedProxyResourceInner class. */ + public ManagedProxyResourceInner() { + } + + /** + * Get the proxy property: The short lived proxy name. + * + * @return the proxy value. + */ + public String proxy() { + return this.proxy; + } + + /** + * Set the proxy property: The short lived proxy name. + * + * @param proxy the proxy value to set. + * @return the ManagedProxyResourceInner object itself. + */ + public ManagedProxyResourceInner withProxy(String proxy) { + this.proxy = proxy; + return this; + } + + /** + * Get the expiresOn property: The expiration time of short lived proxy name in unix epoch. + * + * @return the expiresOn value. + */ + public long expiresOn() { + return this.expiresOn; + } + + /** + * Set the expiresOn property: The expiration time of short lived proxy name in unix epoch. + * + * @param expiresOn the expiresOn value to set. + * @return the ManagedProxyResourceInner object itself. + */ + public ManagedProxyResourceInner withExpiresOn(long expiresOn) { + this.expiresOn = expiresOn; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (proxy() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property proxy in model ManagedProxyResourceInner")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedProxyResourceInner.class); +} 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..0e27547f98a6 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/OperationInner.java @@ -0,0 +1,127 @@ +// 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.resourcemanager.hybridconnectivity.models.ActionType; +import com.azure.resourcemanager.hybridconnectivity.models.OperationDisplay; +import com.azure.resourcemanager.hybridconnectivity.models.Origin; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * REST API Operation + * + *

Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationInner { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + @JsonProperty(value = "actionType", access = JsonProperty.Access.WRITE_ONLY) + private ActionType actionType; + + /** Creates an instance of OperationInner class. */ + public OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} 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..49f1b53894a4 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/RelayNamespaceAccessProperties.java @@ -0,0 +1,190 @@ +// 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.JsonProperty; + +/** Azure relay hybrid connection access properties. */ +@Fluent +public final class RelayNamespaceAccessProperties { + /* + * 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; + + /* + * The token to access the enabled service. + */ + @JsonProperty(value = "serviceConfigurationToken") + private String serviceConfigurationToken; + + /** Creates an instance of RelayNamespaceAccessProperties class. */ + public RelayNamespaceAccessProperties() { + } + + /** + * 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; + } + + /** + * Get the serviceConfigurationToken property: The token to access the enabled service. + * + * @return the serviceConfigurationToken value. + */ + public String serviceConfigurationToken() { + return this.serviceConfigurationToken; + } + + /** + * Set the serviceConfigurationToken property: The token to access the enabled service. + * + * @param serviceConfigurationToken the serviceConfigurationToken value to set. + * @return the RelayNamespaceAccessProperties object itself. + */ + public RelayNamespaceAccessProperties withServiceConfigurationToken(String serviceConfigurationToken) { + this.serviceConfigurationToken = serviceConfigurationToken; + 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")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RelayNamespaceAccessProperties.class); +} 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..ae5e6473dc64 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/EndpointAccessResourceImpl.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.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 String serviceConfigurationToken() { + return this.innerModel().serviceConfigurationToken(); + } + + 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..88ab6bac8d63 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/EndpointResourceImpl.java @@ -0,0 +1,213 @@ +// 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.IngressGatewayResource; +import com.azure.resourcemanager.hybridconnectivity.models.ListCredentialsRequest; +import com.azure.resourcemanager.hybridconnectivity.models.ManagedProxyRequest; +import com.azure.resourcemanager.hybridconnectivity.models.ManagedProxyResource; +import com.azure.resourcemanager.hybridconnectivity.models.ServiceConfiguration; +import com.azure.resourcemanager.hybridconnectivity.models.Type; +import java.util.Collections; +import java.util.List; + +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 List serviceConfigurations() { + List inner = this.innerModel().serviceConfigurations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + 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 Response listCredentialsWithResponse( + Long expiresin, ListCredentialsRequest listCredentialsRequest, Context context) { + return serviceManager + .endpoints() + .listCredentialsWithResponse(resourceUri, endpointName, expiresin, listCredentialsRequest, context); + } + + public EndpointAccessResource listCredentials() { + return serviceManager.endpoints().listCredentials(resourceUri, endpointName); + } + + public Response listIngressGatewayCredentialsWithResponse(Long expiresin, Context context) { + return serviceManager + .endpoints() + .listIngressGatewayCredentialsWithResponse(resourceUri, endpointName, expiresin, context); + } + + public IngressGatewayResource listIngressGatewayCredentials() { + return serviceManager.endpoints().listIngressGatewayCredentials(resourceUri, endpointName); + } + + public Response listManagedProxyDetailsWithResponse( + ManagedProxyRequest managedProxyRequest, Context context) { + return serviceManager + .endpoints() + .listManagedProxyDetailsWithResponse(resourceUri, endpointName, managedProxyRequest, context); + } + + public ManagedProxyResource listManagedProxyDetails(ManagedProxyRequest managedProxyRequest) { + return serviceManager.endpoints().listManagedProxyDetails(resourceUri, endpointName, managedProxyRequest); + } + + public EndpointResourceImpl withTypePropertiesType(Type typePropertiesType) { + this.innerModel().withTypePropertiesType(typePropertiesType); + return this; + } + + public EndpointResourceImpl withResourceId(String resourceId) { + this.innerModel().withResourceId(resourceId); + return this; + } + + public EndpointResourceImpl withServiceConfigurations(List serviceConfigurations) { + this.innerModel().withServiceConfigurations(serviceConfigurations); + 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..773b78ae2eb5 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/EndpointsClientImpl.java @@ -0,0 +1,1360 @@ +// 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.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.fluent.models.IngressGatewayResourceInner; +import com.azure.resourcemanager.hybridconnectivity.fluent.models.ManagedProxyResourceInner; +import com.azure.resourcemanager.hybridconnectivity.models.EndpointsList; +import com.azure.resourcemanager.hybridconnectivity.models.ListCredentialsRequest; +import com.azure.resourcemanager.hybridconnectivity.models.ManagedProxyRequest; +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 { + /** 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") + public 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, + @BodyParam("application/json") ListCredentialsRequest listCredentialsRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}" + + "/listIngressGatewayCredentials") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listIngressGatewayCredentials( + @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"}) + @Post("/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listManagedProxyDetails") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listManagedProxyDetails( + @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") ManagedProxyRequest managedProxyRequest, + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceUri) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.list(this.client.getEndpoint(), 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceUri, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceUri, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceUri, String endpointName) { + return getWithResponseAsync(resourceUri, endpointName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceUri, String endpointName, Context context) { + return getWithResponseAsync(resourceUri, endpointName, context).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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 getWithResponse(resourceUri, endpointName, Context.NONE).getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceUri, String endpointName, EndpointResourceInner endpointResource) { + return createOrUpdateWithResponseAsync(resourceUri, endpointName, endpointResource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceUri, String endpointName, EndpointResourceInner endpointResource, Context context) { + return createOrUpdateWithResponseAsync(resourceUri, endpointName, endpointResource, 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) + public EndpointResourceInner createOrUpdate( + String resourceUri, String endpointName, EndpointResourceInner endpointResource) { + return createOrUpdateWithResponse(resourceUri, endpointName, endpointResource, Context.NONE).getValue(); + } + + /** + * 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceUri, String endpointName, EndpointResourceInner endpointResource) { + return updateWithResponseAsync(resourceUri, endpointName, endpointResource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceUri, String endpointName, EndpointResourceInner endpointResource, Context context) { + return updateWithResponseAsync(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) + public EndpointResourceInner update( + String resourceUri, String endpointName, EndpointResourceInner endpointResource) { + return updateWithResponse(resourceUri, endpointName, endpointResource, Context.NONE).getValue(); + } + + /** + * 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceUri, String endpointName) { + return deleteWithResponseAsync(resourceUri, endpointName).flatMap(ignored -> 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceUri, String endpointName, Context context) { + return deleteWithResponseAsync(resourceUri, endpointName, 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceUri, String endpointName) { + deleteWithResponse(resourceUri, endpointName, Context.NONE); + } + + /** + * 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 listCredentialsRequest Object of type ListCredentialsRequest. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCredentialsWithResponseAsync( + String resourceUri, String endpointName, Long expiresin, ListCredentialsRequest listCredentialsRequest) { + 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 (listCredentialsRequest != null) { + listCredentialsRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listCredentials( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceUri, + endpointName, + expiresin, + listCredentialsRequest, + 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 listCredentialsRequest Object of type ListCredentialsRequest. + * @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCredentialsWithResponseAsync( + String resourceUri, + String endpointName, + Long expiresin, + ListCredentialsRequest listCredentialsRequest, + 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 (listCredentialsRequest != null) { + listCredentialsRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listCredentials( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceUri, + endpointName, + expiresin, + listCredentialsRequest, + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listCredentialsAsync(String resourceUri, String endpointName) { + final Long expiresin = null; + final ListCredentialsRequest listCredentialsRequest = null; + return listCredentialsWithResponseAsync(resourceUri, endpointName, expiresin, listCredentialsRequest) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 listCredentialsRequest Object of type ListCredentialsRequest. + * @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listCredentialsWithResponse( + String resourceUri, + String endpointName, + Long expiresin, + ListCredentialsRequest listCredentialsRequest, + Context context) { + return listCredentialsWithResponseAsync(resourceUri, endpointName, expiresin, listCredentialsRequest, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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; + final ListCredentialsRequest listCredentialsRequest = null; + return listCredentialsWithResponse(resourceUri, endpointName, expiresin, listCredentialsRequest, Context.NONE) + .getValue(); + } + + /** + * Gets the ingress gateway endpoint credentials. + * + * @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 ingress gateway endpoint credentials along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listIngressGatewayCredentialsWithResponseAsync( + 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 + .listIngressGatewayCredentials( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceUri, + endpointName, + expiresin, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the ingress gateway endpoint credentials. + * + * @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 ingress gateway endpoint credentials along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listIngressGatewayCredentialsWithResponseAsync( + 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 + .listIngressGatewayCredentials( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceUri, + endpointName, + expiresin, + accept, + context); + } + + /** + * Gets the ingress gateway endpoint credentials. + * + * @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 ingress gateway endpoint credentials on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listIngressGatewayCredentialsAsync( + String resourceUri, String endpointName) { + final Long expiresin = null; + return listIngressGatewayCredentialsWithResponseAsync(resourceUri, endpointName, expiresin) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the ingress gateway endpoint credentials. + * + * @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 ingress gateway endpoint credentials along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listIngressGatewayCredentialsWithResponse( + String resourceUri, String endpointName, Long expiresin, Context context) { + return listIngressGatewayCredentialsWithResponseAsync(resourceUri, endpointName, expiresin, context).block(); + } + + /** + * Gets the ingress gateway endpoint credentials. + * + * @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 ingress gateway endpoint credentials. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IngressGatewayResourceInner listIngressGatewayCredentials(String resourceUri, String endpointName) { + final Long expiresin = null; + return listIngressGatewayCredentialsWithResponse(resourceUri, endpointName, expiresin, Context.NONE).getValue(); + } + + /** + * Fetches the managed proxy details. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param managedProxyRequest Object of type ManagedProxyRequest. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed Proxy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listManagedProxyDetailsWithResponseAsync( + String resourceUri, String endpointName, ManagedProxyRequest managedProxyRequest) { + 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 (managedProxyRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedProxyRequest is required and cannot be null.")); + } else { + managedProxyRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listManagedProxyDetails( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceUri, + endpointName, + managedProxyRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Fetches the managed proxy details. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param managedProxyRequest Object of type ManagedProxyRequest. + * @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 managed Proxy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listManagedProxyDetailsWithResponseAsync( + String resourceUri, String endpointName, ManagedProxyRequest managedProxyRequest, 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 (managedProxyRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedProxyRequest is required and cannot be null.")); + } else { + managedProxyRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listManagedProxyDetails( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceUri, + endpointName, + managedProxyRequest, + accept, + context); + } + + /** + * Fetches the managed proxy details. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param managedProxyRequest Object of type ManagedProxyRequest. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed Proxy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listManagedProxyDetailsAsync( + String resourceUri, String endpointName, ManagedProxyRequest managedProxyRequest) { + return listManagedProxyDetailsWithResponseAsync(resourceUri, endpointName, managedProxyRequest) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Fetches the managed proxy details. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param managedProxyRequest Object of type ManagedProxyRequest. + * @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 managed Proxy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listManagedProxyDetailsWithResponse( + String resourceUri, String endpointName, ManagedProxyRequest managedProxyRequest, Context context) { + return listManagedProxyDetailsWithResponseAsync(resourceUri, endpointName, managedProxyRequest, context) + .block(); + } + + /** + * Fetches the managed proxy details. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param managedProxyRequest Object of type ManagedProxyRequest. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed Proxy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedProxyResourceInner listManagedProxyDetails( + String resourceUri, String endpointName, ManagedProxyRequest managedProxyRequest) { + return listManagedProxyDetailsWithResponse(resourceUri, endpointName, managedProxyRequest, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/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..5b8fa99eaa63 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/EndpointsImpl.java @@ -0,0 +1,288 @@ +// 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.fluent.models.IngressGatewayResourceInner; +import com.azure.resourcemanager.hybridconnectivity.fluent.models.ManagedProxyResourceInner; +import com.azure.resourcemanager.hybridconnectivity.models.EndpointAccessResource; +import com.azure.resourcemanager.hybridconnectivity.models.EndpointResource; +import com.azure.resourcemanager.hybridconnectivity.models.Endpoints; +import com.azure.resourcemanager.hybridconnectivity.models.IngressGatewayResource; +import com.azure.resourcemanager.hybridconnectivity.models.ListCredentialsRequest; +import com.azure.resourcemanager.hybridconnectivity.models.ManagedProxyRequest; +import com.azure.resourcemanager.hybridconnectivity.models.ManagedProxyResource; + +public final class EndpointsImpl implements Endpoints { + private static 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 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 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 deleteByResourceGroupWithResponse(String resourceUri, String endpointName, Context context) { + return this.serviceClient().deleteWithResponse(resourceUri, endpointName, context); + } + + public void deleteByResourceGroup(String resourceUri, String endpointName) { + this.serviceClient().delete(resourceUri, endpointName); + } + + public Response listCredentialsWithResponse( + String resourceUri, + String endpointName, + Long expiresin, + ListCredentialsRequest listCredentialsRequest, + Context context) { + Response inner = + this + .serviceClient() + .listCredentialsWithResponse(resourceUri, endpointName, expiresin, listCredentialsRequest, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EndpointAccessResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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 listIngressGatewayCredentialsWithResponse( + String resourceUri, String endpointName, Long expiresin, Context context) { + Response inner = + this + .serviceClient() + .listIngressGatewayCredentialsWithResponse(resourceUri, endpointName, expiresin, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IngressGatewayResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public IngressGatewayResource listIngressGatewayCredentials(String resourceUri, String endpointName) { + IngressGatewayResourceInner inner = + this.serviceClient().listIngressGatewayCredentials(resourceUri, endpointName); + if (inner != null) { + return new IngressGatewayResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listManagedProxyDetailsWithResponse( + String resourceUri, String endpointName, ManagedProxyRequest managedProxyRequest, Context context) { + Response inner = + this + .serviceClient() + .listManagedProxyDetailsWithResponse(resourceUri, endpointName, managedProxyRequest, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedProxyResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedProxyResource listManagedProxyDetails( + String resourceUri, String endpointName, ManagedProxyRequest managedProxyRequest) { + ManagedProxyResourceInner inner = + this.serviceClient().listManagedProxyDetails(resourceUri, endpointName, managedProxyRequest); + if (inner != null) { + return new ManagedProxyResourceImpl(inner, 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.deleteByResourceGroupWithResponse(resourceUri, endpointName, Context.NONE); + } + + 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.deleteByResourceGroupWithResponse(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..c1317111504c --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/HybridConnectivityManagementApiBuilder.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.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 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 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 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() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = + (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval = + (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = + (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + HybridConnectivityManagementApiImpl client = + new HybridConnectivityManagementApiImpl( + localPipeline, localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint); + 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..01f39c2ec05d --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/HybridConnectivityManagementApiImpl.java @@ -0,0 +1,289 @@ +// 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.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.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 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 { + /** 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 = "2023-03-15"; + 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) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(HybridConnectivityManagementApiImpl.class); +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/IngressGatewayResourceImpl.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/IngressGatewayResourceImpl.java new file mode 100644 index 000000000000..5b24c583fa37 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/IngressGatewayResourceImpl.java @@ -0,0 +1,65 @@ +// 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.IngressGatewayResourceInner; +import com.azure.resourcemanager.hybridconnectivity.models.IngressGatewayResource; + +public final class IngressGatewayResourceImpl implements IngressGatewayResource { + private IngressGatewayResourceInner innerObject; + + private final com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager serviceManager; + + IngressGatewayResourceImpl( + IngressGatewayResourceInner 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 String serviceConfigurationToken() { + return this.innerModel().serviceConfigurationToken(); + } + + public String hostname() { + return this.innerModel().hostname(); + } + + public String serverId() { + return this.innerModel().serverId(); + } + + public String tenantId() { + return this.innerModel().tenantId(); + } + + public IngressGatewayResourceInner 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/ManagedProxyResourceImpl.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/ManagedProxyResourceImpl.java new file mode 100644 index 000000000000..85a796ea1f7c --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/ManagedProxyResourceImpl.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.implementation; + +import com.azure.resourcemanager.hybridconnectivity.fluent.models.ManagedProxyResourceInner; +import com.azure.resourcemanager.hybridconnectivity.models.ManagedProxyResource; + +public final class ManagedProxyResourceImpl implements ManagedProxyResource { + private ManagedProxyResourceInner innerObject; + + private final com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager serviceManager; + + ManagedProxyResourceImpl( + ManagedProxyResourceInner innerObject, + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String proxy() { + return this.innerModel().proxy(); + } + + public long expiresOn() { + return this.innerModel().expiresOn(); + } + + public ManagedProxyResourceInner 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/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..b084911dd406 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/OperationsClientImpl.java @@ -0,0 +1,276 @@ +// 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.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 { + /** 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") + public 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 along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the available 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 along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the available 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 as paginated response with {@link + * PagedFlux}. + */ + @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 as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the available 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 as paginated response with {@link + * PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/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..6e59d4284f04 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/OperationsImpl.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.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; + +public final class OperationsImpl implements Operations { + private static 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..582abe8cde08 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/ActionType.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ +public final class ActionType extends ExpandableStringEnum { + /** Static value Internal for ActionType. */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates 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); + } + + /** + * Gets known ActionType values. + * + * @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..65f029952933 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/EndpointAccessResource.java @@ -0,0 +1,59 @@ +// 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 serviceConfigurationToken property: The token to access the enabled service. + * + * @return the serviceConfigurationToken value. + */ + String serviceConfigurationToken(); + + /** + * 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..f20b26daf2d7 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/EndpointResource.java @@ -0,0 +1,284 @@ +// 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; +import java.util.List; + +/** 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 resource provisioning state. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the serviceConfigurations property: The enabled service configurations. + * + * @return the serviceConfigurations value. + */ + List serviceConfigurations(); + + /** + * 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, + DefinitionStages.WithServiceConfigurations { + /** + * 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); + } + /** The stage of the EndpointResource definition allowing to specify serviceConfigurations. */ + interface WithServiceConfigurations { + /** + * Specifies the serviceConfigurations property: The enabled service configurations.. + * + * @param serviceConfigurations The enabled service configurations. + * @return the next definition stage. + */ + WithCreate withServiceConfigurations(List serviceConfigurations); + } + } + /** + * 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, + UpdateStages.WithServiceConfigurations { + /** + * 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); + } + /** The stage of the EndpointResource update allowing to specify serviceConfigurations. */ + interface WithServiceConfigurations { + /** + * Specifies the serviceConfigurations property: The enabled service configurations.. + * + * @param serviceConfigurations The enabled service configurations. + * @return the next definition stage. + */ + Update withServiceConfigurations(List serviceConfigurations); + } + } + /** + * 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. + * + * @param expiresin The is how long the endpoint access token is valid (in seconds). + * @param listCredentialsRequest Object of type ListCredentialsRequest. + * @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 along with {@link Response}. + */ + Response listCredentialsWithResponse( + Long expiresin, ListCredentialsRequest listCredentialsRequest, 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 ingress gateway endpoint credentials. + * + * @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 ingress gateway endpoint credentials along with {@link Response}. + */ + Response listIngressGatewayCredentialsWithResponse(Long expiresin, Context context); + + /** + * Gets the ingress gateway endpoint credentials. + * + * @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 ingress gateway endpoint credentials. + */ + IngressGatewayResource listIngressGatewayCredentials(); + + /** + * Fetches the managed proxy details. + * + * @param managedProxyRequest Object of type ManagedProxyRequest. + * @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 managed Proxy along with {@link Response}. + */ + Response listManagedProxyDetailsWithResponse( + ManagedProxyRequest managedProxyRequest, Context context); + + /** + * Fetches the managed proxy details. + * + * @param managedProxyRequest Object of type ManagedProxyRequest. + * @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 managed Proxy. + */ + ManagedProxyResource listManagedProxyDetails(ManagedProxyRequest managedProxyRequest); +} 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..9807962155f6 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/Endpoints.java @@ -0,0 +1,225 @@ +// 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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. + * @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 along with {@link Response}. + */ + Response getWithResponse(String resourceUri, String endpointName, 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); + + /** + * 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 {@link Response}. + */ + Response deleteByResourceGroupWithResponse(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); + + /** + * 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 listCredentialsRequest Object of type ListCredentialsRequest. + * @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 along with {@link Response}. + */ + Response listCredentialsWithResponse( + String resourceUri, + String endpointName, + Long expiresin, + ListCredentialsRequest listCredentialsRequest, + 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 ingress gateway endpoint credentials. + * + * @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 ingress gateway endpoint credentials along with {@link Response}. + */ + Response listIngressGatewayCredentialsWithResponse( + String resourceUri, String endpointName, Long expiresin, Context context); + + /** + * Gets the ingress gateway endpoint credentials. + * + * @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 ingress gateway endpoint credentials. + */ + IngressGatewayResource listIngressGatewayCredentials(String resourceUri, String endpointName); + + /** + * Fetches the managed proxy details. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param managedProxyRequest Object of type ManagedProxyRequest. + * @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 managed Proxy along with {@link Response}. + */ + Response listManagedProxyDetailsWithResponse( + String resourceUri, String endpointName, ManagedProxyRequest managedProxyRequest, Context context); + + /** + * Fetches the managed proxy details. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource to be connected. + * @param endpointName The endpoint name. + * @param managedProxyRequest Object of type ManagedProxyRequest. + * @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 managed Proxy. + */ + ManagedProxyResource listManagedProxyDetails( + String resourceUri, String endpointName, ManagedProxyRequest managedProxyRequest); + + /** + * 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 {@link 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..16563fcef082 --- /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.resourcemanager.hybridconnectivity.fluent.models.EndpointResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of endpoints. */ +@Fluent +public final class EndpointsList { + /* + * 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; + + /** Creates an instance of EndpointsList class. */ + public EndpointsList() { + } + + /** + * 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/IngressGatewayResource.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/IngressGatewayResource.java new file mode 100644 index 000000000000..e9f8e61e8757 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/IngressGatewayResource.java @@ -0,0 +1,80 @@ +// 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.IngressGatewayResourceInner; + +/** An immutable client-side representation of IngressGatewayResource. */ +public interface IngressGatewayResource { + /** + * 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 serviceConfigurationToken property: The token to access the enabled service. + * + * @return the serviceConfigurationToken value. + */ + String serviceConfigurationToken(); + + /** + * Gets the hostname property: The ingress hostname. + * + * @return the hostname value. + */ + String hostname(); + + /** + * Gets the serverId property: The arc ingress gateway server app id. + * + * @return the serverId value. + */ + String serverId(); + + /** + * Gets the tenantId property: The target resource home tenant id. + * + * @return the tenantId value. + */ + String tenantId(); + + /** + * Gets the inner com.azure.resourcemanager.hybridconnectivity.fluent.models.IngressGatewayResourceInner object. + * + * @return the inner object. + */ + IngressGatewayResourceInner innerModel(); +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/ListCredentialsRequest.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/ListCredentialsRequest.java new file mode 100644 index 000000000000..288beb45e386 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/ListCredentialsRequest.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represent ListCredentials Request object. */ +@Fluent +public final class ListCredentialsRequest { + /* + * The name of the service. + */ + @JsonProperty(value = "serviceName") + private ServiceName serviceName; + + /** Creates an instance of ListCredentialsRequest class. */ + public ListCredentialsRequest() { + } + + /** + * Get the serviceName property: The name of the service. + * + * @return the serviceName value. + */ + public ServiceName serviceName() { + return this.serviceName; + } + + /** + * Set the serviceName property: The name of the service. + * + * @param serviceName the serviceName value to set. + * @return the ListCredentialsRequest object itself. + */ + public ListCredentialsRequest withServiceName(ServiceName serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * 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/ManagedProxyRequest.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/ManagedProxyRequest.java new file mode 100644 index 000000000000..8f14366a0987 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/ManagedProxyRequest.java @@ -0,0 +1,110 @@ +// 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.fasterxml.jackson.annotation.JsonProperty; + +/** Represent ManageProxy Request object. */ +@Fluent +public final class ManagedProxyRequest { + /* + * The name of the service. + */ + @JsonProperty(value = "service", required = true) + private String service; + + /* + * The target host name. + */ + @JsonProperty(value = "hostname") + private String hostname; + + /* + * The name of the service. + */ + @JsonProperty(value = "serviceName") + private ServiceName serviceName; + + /** Creates an instance of ManagedProxyRequest class. */ + public ManagedProxyRequest() { + } + + /** + * Get the service property: The name of the service. + * + * @return the service value. + */ + public String service() { + return this.service; + } + + /** + * Set the service property: The name of the service. + * + * @param service the service value to set. + * @return the ManagedProxyRequest object itself. + */ + public ManagedProxyRequest withService(String service) { + this.service = service; + return this; + } + + /** + * Get the hostname property: The target host name. + * + * @return the hostname value. + */ + public String hostname() { + return this.hostname; + } + + /** + * Set the hostname property: The target host name. + * + * @param hostname the hostname value to set. + * @return the ManagedProxyRequest object itself. + */ + public ManagedProxyRequest withHostname(String hostname) { + this.hostname = hostname; + return this; + } + + /** + * Get the serviceName property: The name of the service. + * + * @return the serviceName value. + */ + public ServiceName serviceName() { + return this.serviceName; + } + + /** + * Set the serviceName property: The name of the service. + * + * @param serviceName the serviceName value to set. + * @return the ManagedProxyRequest object itself. + */ + public ManagedProxyRequest withServiceName(ServiceName serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (service() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property service in model ManagedProxyRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedProxyRequest.class); +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/ManagedProxyResource.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/ManagedProxyResource.java new file mode 100644 index 000000000000..67754b418274 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/ManagedProxyResource.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.resourcemanager.hybridconnectivity.fluent.models.ManagedProxyResourceInner; + +/** An immutable client-side representation of ManagedProxyResource. */ +public interface ManagedProxyResource { + /** + * Gets the proxy property: The short lived proxy name. + * + * @return the proxy value. + */ + String proxy(); + + /** + * Gets the expiresOn property: The expiration time of short lived proxy name in unix epoch. + * + * @return the expiresOn value. + */ + long expiresOn(); + + /** + * Gets the inner com.azure.resourcemanager.hybridconnectivity.fluent.models.ManagedProxyResourceInner object. + * + * @return the inner object. + */ + ManagedProxyResourceInner innerModel(); +} 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..5126bc9e0d36 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/OperationDisplay.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Localized display information for this particular operation. */ +@Immutable +public final class OperationDisplay { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + * Compute". + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + * Schedule Collections". + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + * Machine", "Restart Virtual Machine". + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** Creates an instance of OperationDisplay class. */ + public OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} 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..e8a4e4983b13 --- /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.resourcemanager.hybridconnectivity.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult { + /* + * List of operations supported by the resource provider + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of OperationListResult class. */ + public OperationListResult() { + } + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} 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..5ca1cd27d097 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/Operations.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 as paginated response with {@link + * PagedIterable}. + */ + 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 as paginated response with {@link + * PagedIterable}. + */ + 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..ead4f7acbef5 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/Origin.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** Static value user for Origin. */ + public static final Origin USER = fromString("user"); + + /** Static value system for Origin. */ + public static final Origin SYSTEM = fromString("system"); + + /** Static value user,system for Origin. */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates 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); + } + + /** + * Gets known Origin values. + * + * @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/ServiceConfiguration.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/ServiceConfiguration.java new file mode 100644 index 000000000000..39241d5c8f86 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/ServiceConfiguration.java @@ -0,0 +1,76 @@ +// 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.fasterxml.jackson.annotation.JsonProperty; + +/** The service configuration object definition. */ +@Fluent +public final class ServiceConfiguration { + /* + * The type of service enabled. + */ + @JsonProperty(value = "serviceName") + private ServiceName serviceName; + + /* + * The port on which service is enabled. + */ + @JsonProperty(value = "port") + private String port; + + /** Creates an instance of ServiceConfiguration class. */ + public ServiceConfiguration() { + } + + /** + * Get the serviceName property: The type of service enabled. + * + * @return the serviceName value. + */ + public ServiceName serviceName() { + return this.serviceName; + } + + /** + * Set the serviceName property: The type of service enabled. + * + * @param serviceName the serviceName value to set. + * @return the ServiceConfiguration object itself. + */ + public ServiceConfiguration withServiceName(ServiceName serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Get the port property: The port on which service is enabled. + * + * @return the port value. + */ + public String port() { + return this.port; + } + + /** + * Set the port property: The port on which service is enabled. + * + * @param port the port value to set. + * @return the ServiceConfiguration object itself. + */ + public ServiceConfiguration withPort(String port) { + this.port = port; + return this; + } + + /** + * 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/ServiceName.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/ServiceName.java new file mode 100644 index 000000000000..bf2c41417674 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/ServiceName.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The type of service enabled. */ +public final class ServiceName extends ExpandableStringEnum { + /** Static value SSH for ServiceName. */ + public static final ServiceName SSH = fromString("SSH"); + + /** Static value WAC for ServiceName. */ + public static final ServiceName WAC = fromString("WAC"); + + /** + * Creates or finds a ServiceName from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServiceName. + */ + @JsonCreator + public static ServiceName fromString(String name) { + return fromString(name, ServiceName.class); + } + + /** + * Gets known ServiceName values. + * + * @return known ServiceName values. + */ + public static Collection values() { + return values(ServiceName.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..11270e33c5da --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/Type.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The type of endpoint. */ +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); + } + + /** + * Gets known Type values. + * + * @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..3dbac349e6cc --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsCreateOrUpdateSamples.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridconnectivity.generated; + +import com.azure.resourcemanager.hybridconnectivity.models.ServiceConfiguration; +import com.azure.resourcemanager.hybridconnectivity.models.ServiceName; +import com.azure.resourcemanager.hybridconnectivity.models.Type; +import java.util.Arrays; + +/** Samples for Endpoints CreateOrUpdate. */ +public final class EndpointsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/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/stable/2023-03-15/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) + .withServiceConfigurations( + Arrays + .asList( + new ServiceConfiguration().withServiceName(ServiceName.SSH).withPort("22"), + new ServiceConfiguration().withServiceName(ServiceName.WAC).withPort("80"))) + .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..be0a09a4aaac --- /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/stable/2023-03-15/examples/EndpointsDeleteDefault.json + */ + /** + * Sample code: HybridConnectivityEndpointsDeleteDefault. + * + * @param manager Entry point to HybridConnectivityManager. + */ + public static void hybridConnectivityEndpointsDeleteDefault( + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager) { + manager + .endpoints() + .deleteByResourceGroupWithResponse( + "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..ae415e44f067 --- /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/stable/2023-03-15/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/stable/2023-03-15/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..d282a00943e9 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsListCredentialsSamples.java @@ -0,0 +1,32 @@ +// 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.ListCredentialsRequest; +import com.azure.resourcemanager.hybridconnectivity.models.ServiceName; + +/** Samples for Endpoints ListCredentials. */ +public final class EndpointsListCredentialsSamples { + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/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, + new ListCredentialsRequest().withServiceName(ServiceName.SSH), + Context.NONE); + } +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsListIngressGatewayCredentialsSamples.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsListIngressGatewayCredentialsSamples.java new file mode 100644 index 000000000000..b1ca59369cd7 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsListIngressGatewayCredentialsSamples.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 ListIngressGatewayCredentials. */ +public final class EndpointsListIngressGatewayCredentialsSamples { + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsPostListIngressGatewayCredentials.json + */ + /** + * Sample code: HybridConnectivityEndpointsPostListIngressGatewayCredentials. + * + * @param manager Entry point to HybridConnectivityManager. + */ + public static void hybridConnectivityEndpointsPostListIngressGatewayCredentials( + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager) { + manager + .endpoints() + .listIngressGatewayCredentialsWithResponse( + "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/arcGroup/providers/Microsoft.ArcPlaceHolder/ProvisionedClusters/cluster0", + "default", + 10800L, + Context.NONE); + } +} diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsListManagedProxyDetailsSamples.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsListManagedProxyDetailsSamples.java new file mode 100644 index 000000000000..f51051a3bdc0 --- /dev/null +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/samples/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsListManagedProxyDetailsSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.hybridconnectivity.models.ManagedProxyRequest; +import com.azure.resourcemanager.hybridconnectivity.models.ServiceName; + +/** Samples for Endpoints ListManagedProxyDetails. */ +public final class EndpointsListManagedProxyDetailsSamples { + /* + * x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsPostListManagedProxyDetails.json + */ + /** + * Sample code: HybridConnectivityEndpointsPostListManagedProxyDetails. + * + * @param manager Entry point to HybridConnectivityManager. + */ + public static void hybridConnectivityEndpointsPostListManagedProxyDetails( + com.azure.resourcemanager.hybridconnectivity.HybridConnectivityManager manager) { + manager + .endpoints() + .listManagedProxyDetailsWithResponse( + "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/arcGroup/providers/Microsoft.Compute/virtualMachines/vm00006", + "default", + new ManagedProxyRequest() + .withService("127.0.0.1:65035") + .withHostname("r.proxy.arc.com") + .withServiceName(ServiceName.WAC), + 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..af14f68edb2f --- /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/stable/2023-03-15/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..961f39b21776 --- /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/stable/2023-03-15/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..b4efc1a00da7 --- /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/stable/2023-03-15/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..acd2f8bbfc60 --- /dev/null +++ b/sdk/hybridconnectivity/ci.yml @@ -0,0 +1,47 @@ +# 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 + +parameters: + - name: release_azureresourcemanagerhybridconnectivity + displayName: azure-resourcemanager-hybridconnectivity + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: hybridconnectivity + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-hybridconnectivity + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerhybridconnectivity + releaseInBatch: ${{ parameters.release_azureresourcemanagerhybridconnectivity }} diff --git a/sdk/hybridconnectivity/pom.xml b/sdk/hybridconnectivity/pom.xml new file mode 100644 index 000000000000..bc7aa3d103f6 --- /dev/null +++ b/sdk/hybridconnectivity/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-hybridconnectivity-service + pom + 1.0.0 + + + azure-resourcemanager-hybridconnectivity + +