diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 53a692e5fff1..3701db71d787 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -231,6 +231,7 @@ com.azure.resourcemanager:azure-resourcemanager-frontdoor;1.0.0-beta.1;1.0.0-bet com.azure.resourcemanager:azure-resourcemanager-mixedreality;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-automation;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-resourcemover;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-peering;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. diff --git a/pom.xml b/pom.xml index c5e7031af8a3..c1187e114a6e 100644 --- a/pom.xml +++ b/pom.xml @@ -698,6 +698,7 @@ sdk/monitor sdk/mysql sdk/netapp + sdk/peering sdk/postgresql sdk/quantum sdk/recoveryservices diff --git a/sdk/peering/azure-resourcemanager-peering/CHANGELOG.md b/sdk/peering/azure-resourcemanager-peering/CHANGELOG.md new file mode 100644 index 000000000000..da5dd68d95ba --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-04-12) + +- Azure Resource Manager Peering client library for Java. This package contains Microsoft Azure SDK for Peering Management SDK. Peering Client. Package tag package-2019-08-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/peering/azure-resourcemanager-peering/README.md b/sdk/peering/azure-resourcemanager-peering/README.md new file mode 100644 index 000000000000..d677feac00f5 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/README.md @@ -0,0 +1,99 @@ +# Azure Resource Manager Peering client library for Java + +Azure Resource Manager Peering client library for Java. + +This package contains Microsoft Azure SDK for Peering Management SDK. Peering Client. Package tag package-2019-08-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-peering;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-peering + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +PeeringManager manager = PeeringManager + .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 + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/peering/azure-resourcemanager-peering/pom.xml b/sdk/peering/azure-resourcemanager-peering/pom.xml new file mode 100644 index 000000000000..74b0a212ed5e --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/pom.xml @@ -0,0 +1,67 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-peering + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Peering Management + This package contains Microsoft Azure SDK for Peering Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Peering Client. Package tag package-2019-08-01-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.15.0 + + + com.azure + azure-core-management + 1.2.1 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/PeeringManager.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/PeeringManager.java new file mode 100644 index 000000000000..cb5af573c129 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/PeeringManager.java @@ -0,0 +1,338 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.fluent.PeeringManagementClient; +import com.azure.resourcemanager.peering.implementation.LegacyPeeringsImpl; +import com.azure.resourcemanager.peering.implementation.OperationsImpl; +import com.azure.resourcemanager.peering.implementation.PeerAsnsImpl; +import com.azure.resourcemanager.peering.implementation.PeeringLocationsImpl; +import com.azure.resourcemanager.peering.implementation.PeeringManagementClientBuilder; +import com.azure.resourcemanager.peering.implementation.PeeringServiceLocationsImpl; +import com.azure.resourcemanager.peering.implementation.PeeringServicePrefixesImpl; +import com.azure.resourcemanager.peering.implementation.PeeringServiceProvidersImpl; +import com.azure.resourcemanager.peering.implementation.PeeringServicesImpl; +import com.azure.resourcemanager.peering.implementation.PeeringsImpl; +import com.azure.resourcemanager.peering.implementation.PrefixesImpl; +import com.azure.resourcemanager.peering.implementation.ResourceProvidersImpl; +import com.azure.resourcemanager.peering.models.LegacyPeerings; +import com.azure.resourcemanager.peering.models.Operations; +import com.azure.resourcemanager.peering.models.PeerAsns; +import com.azure.resourcemanager.peering.models.PeeringLocations; +import com.azure.resourcemanager.peering.models.PeeringServiceLocations; +import com.azure.resourcemanager.peering.models.PeeringServicePrefixes; +import com.azure.resourcemanager.peering.models.PeeringServiceProviders; +import com.azure.resourcemanager.peering.models.PeeringServices; +import com.azure.resourcemanager.peering.models.Peerings; +import com.azure.resourcemanager.peering.models.Prefixes; +import com.azure.resourcemanager.peering.models.ResourceProviders; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to PeeringManager. Peering Client. */ +public final class PeeringManager { + private ResourceProviders resourceProviders; + + private LegacyPeerings legacyPeerings; + + private Operations operations; + + private PeerAsns peerAsns; + + private PeeringLocations peeringLocations; + + private Peerings peerings; + + private PeeringServiceLocations peeringServiceLocations; + + private PeeringServicePrefixes peeringServicePrefixes; + + private Prefixes prefixes; + + private PeeringServiceProviders peeringServiceProviders; + + private PeeringServices peeringServices; + + private final PeeringManagementClient clientObject; + + private PeeringManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new PeeringManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Peering service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Peering service API instance. + */ + public static PeeringManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create PeeringManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new PeeringManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Peering service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Peering service API instance. + */ + public PeeringManager 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.peering") + .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 (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies + .add( + new BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new PeeringManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of ResourceProviders. */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + + /** @return Resource collection API of LegacyPeerings. */ + public LegacyPeerings legacyPeerings() { + if (this.legacyPeerings == null) { + this.legacyPeerings = new LegacyPeeringsImpl(clientObject.getLegacyPeerings(), this); + } + return legacyPeerings; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of PeerAsns. */ + public PeerAsns peerAsns() { + if (this.peerAsns == null) { + this.peerAsns = new PeerAsnsImpl(clientObject.getPeerAsns(), this); + } + return peerAsns; + } + + /** @return Resource collection API of PeeringLocations. */ + public PeeringLocations peeringLocations() { + if (this.peeringLocations == null) { + this.peeringLocations = new PeeringLocationsImpl(clientObject.getPeeringLocations(), this); + } + return peeringLocations; + } + + /** @return Resource collection API of Peerings. */ + public Peerings peerings() { + if (this.peerings == null) { + this.peerings = new PeeringsImpl(clientObject.getPeerings(), this); + } + return peerings; + } + + /** @return Resource collection API of PeeringServiceLocations. */ + public PeeringServiceLocations peeringServiceLocations() { + if (this.peeringServiceLocations == null) { + this.peeringServiceLocations = + new PeeringServiceLocationsImpl(clientObject.getPeeringServiceLocations(), this); + } + return peeringServiceLocations; + } + + /** @return Resource collection API of PeeringServicePrefixes. */ + public PeeringServicePrefixes peeringServicePrefixes() { + if (this.peeringServicePrefixes == null) { + this.peeringServicePrefixes = + new PeeringServicePrefixesImpl(clientObject.getPeeringServicePrefixes(), this); + } + return peeringServicePrefixes; + } + + /** @return Resource collection API of Prefixes. */ + public Prefixes prefixes() { + if (this.prefixes == null) { + this.prefixes = new PrefixesImpl(clientObject.getPrefixes(), this); + } + return prefixes; + } + + /** @return Resource collection API of PeeringServiceProviders. */ + public PeeringServiceProviders peeringServiceProviders() { + if (this.peeringServiceProviders == null) { + this.peeringServiceProviders = + new PeeringServiceProvidersImpl(clientObject.getPeeringServiceProviders(), this); + } + return peeringServiceProviders; + } + + /** @return Resource collection API of PeeringServices. */ + public PeeringServices peeringServices() { + if (this.peeringServices == null) { + this.peeringServices = new PeeringServicesImpl(clientObject.getPeeringServices(), this); + } + return peeringServices; + } + + /** + * @return Wrapped service client PeeringManagementClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + */ + public PeeringManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/LegacyPeeringsClient.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/LegacyPeeringsClient.java new file mode 100644 index 000000000000..44bc1b9315e3 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/LegacyPeeringsClient.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.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.peering.fluent.models.PeeringInner; +import com.azure.resourcemanager.peering.models.LegacyPeeringsKind; + +/** An instance of this class provides access to all the operations defined in LegacyPeeringsClient. */ +public interface LegacyPeeringsClient { + /** + * Lists all of the legacy peerings under the given subscription matching the specified kind and location. + * + * @param peeringLocation The location of the peering. + * @param kind The kind of the peering. + * @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 paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String peeringLocation, LegacyPeeringsKind kind); + + /** + * Lists all of the legacy peerings under the given subscription matching the specified kind and location. + * + * @param peeringLocation The location of the peering. + * @param kind The kind of the peering. + * @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 paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String peeringLocation, LegacyPeeringsKind kind, Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/OperationsClient.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/OperationsClient.java new file mode 100644 index 000000000000..acbe3f579e2a --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.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.peering.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all of the available API operations for peering resources. + * + * @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 paginated list of peering API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available API operations for peering resources. + * + * @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 paginated list of peering API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeerAsnsClient.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeerAsnsClient.java new file mode 100644 index 000000000000..6f3505ddf197 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeerAsnsClient.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.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.peering.fluent.models.PeerAsnInner; + +/** An instance of this class provides access to all the operations defined in PeerAsnsClient. */ +public interface PeerAsnsClient { + /** + * Gets the peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN 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 peer ASN with the specified name under the given subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PeerAsnInner get(String peerAsnName); + + /** + * Gets the peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN 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 peer ASN with the specified name under the given subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String peerAsnName, Context context); + + /** + * Creates a new peer ASN or updates an existing peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN name. + * @param peerAsn The peer ASN. + * @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 essential information related to the peer's ASN. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PeerAsnInner createOrUpdate(String peerAsnName, PeerAsnInner peerAsn); + + /** + * Creates a new peer ASN or updates an existing peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN name. + * @param peerAsn The peer ASN. + * @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 essential information related to the peer's ASN. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String peerAsnName, PeerAsnInner peerAsn, Context context); + + /** + * Deletes an existing peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN 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 peerAsnName); + + /** + * Deletes an existing peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String peerAsnName, Context context); + + /** + * Lists all of the peer ASNs under the given subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peer ASNs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the peer ASNs under the given subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peer ASNs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringLocationsClient.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringLocationsClient.java new file mode 100644 index 000000000000..0b3945229967 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringLocationsClient.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.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.peering.fluent.models.PeeringLocationInner; +import com.azure.resourcemanager.peering.models.PeeringLocationsDirectPeeringType; +import com.azure.resourcemanager.peering.models.PeeringLocationsKind; + +/** An instance of this class provides access to all the operations defined in PeeringLocationsClient. */ +public interface PeeringLocationsClient { + /** + * Lists all of the available peering locations for the specified kind of peering. + * + * @param kind The kind of the peering. + * @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 paginated list of peering locations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(PeeringLocationsKind kind); + + /** + * Lists all of the available peering locations for the specified kind of peering. + * + * @param kind The kind of the peering. + * @param directPeeringType The type of direct peering. + * @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 paginated list of peering locations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + PeeringLocationsKind kind, PeeringLocationsDirectPeeringType directPeeringType, Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringManagementClient.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringManagementClient.java new file mode 100644 index 000000000000..91da6d848e04 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringManagementClient.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.peering.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for PeeringManagementClient class. */ +public interface PeeringManagementClient { + /** + * Gets The Azure subscription ID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + ResourceProvidersClient getResourceProviders(); + + /** + * Gets the LegacyPeeringsClient object to access its operations. + * + * @return the LegacyPeeringsClient object. + */ + LegacyPeeringsClient getLegacyPeerings(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the PeerAsnsClient object to access its operations. + * + * @return the PeerAsnsClient object. + */ + PeerAsnsClient getPeerAsns(); + + /** + * Gets the PeeringLocationsClient object to access its operations. + * + * @return the PeeringLocationsClient object. + */ + PeeringLocationsClient getPeeringLocations(); + + /** + * Gets the PeeringsClient object to access its operations. + * + * @return the PeeringsClient object. + */ + PeeringsClient getPeerings(); + + /** + * Gets the PeeringServiceLocationsClient object to access its operations. + * + * @return the PeeringServiceLocationsClient object. + */ + PeeringServiceLocationsClient getPeeringServiceLocations(); + + /** + * Gets the PeeringServicePrefixesClient object to access its operations. + * + * @return the PeeringServicePrefixesClient object. + */ + PeeringServicePrefixesClient getPeeringServicePrefixes(); + + /** + * Gets the PrefixesClient object to access its operations. + * + * @return the PrefixesClient object. + */ + PrefixesClient getPrefixes(); + + /** + * Gets the PeeringServiceProvidersClient object to access its operations. + * + * @return the PeeringServiceProvidersClient object. + */ + PeeringServiceProvidersClient getPeeringServiceProviders(); + + /** + * Gets the PeeringServicesClient object to access its operations. + * + * @return the PeeringServicesClient object. + */ + PeeringServicesClient getPeeringServices(); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringServiceLocationsClient.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringServiceLocationsClient.java new file mode 100644 index 000000000000..4eb5a2609ab9 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringServiceLocationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.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.peering.fluent.models.PeeringServiceLocationInner; + +/** An instance of this class provides access to all the operations defined in PeeringServiceLocationsClient. */ +public interface PeeringServiceLocationsClient { + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @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 paginated list of peering service locations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @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 paginated list of peering service locations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringServicePrefixesClient.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringServicePrefixesClient.java new file mode 100644 index 000000000000..ea07d29052ab --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringServicePrefixesClient.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.peering.fluent.models.PeeringServicePrefixInner; + +/** An instance of this class provides access to all the operations defined in PeeringServicePrefixesClient. */ +public interface PeeringServicePrefixesClient { + /** + * Gets the peering service prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix 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 peering service prefix. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PeeringServicePrefixInner get(String resourceGroupName, String peeringServiceName, String prefixName); + + /** + * Gets the peering service prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix 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 peering service prefix. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String peeringServiceName, String prefixName, Context context); + + /** + * Creates or updates the peering prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix name. + * @param peeringServicePrefix The IP prefix for an peering. + * @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 peering service prefix class. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PeeringServicePrefixInner createOrUpdate( + String resourceGroupName, + String peeringServiceName, + String prefixName, + PeeringServicePrefixInner peeringServicePrefix); + + /** + * Creates or updates the peering prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix name. + * @param peeringServicePrefix The IP prefix for an peering. + * @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 peering service prefix class. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String peeringServiceName, + String prefixName, + PeeringServicePrefixInner peeringServicePrefix, + Context context); + + /** + * removes the peering prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix 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 resourceGroupName, String peeringServiceName, String prefixName); + + /** + * removes the peering prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String peeringServiceName, String prefixName, Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringServiceProvidersClient.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringServiceProvidersClient.java new file mode 100644 index 000000000000..f09e1f33e5c6 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringServiceProvidersClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.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.peering.fluent.models.PeeringServiceProviderInner; + +/** An instance of this class provides access to all the operations defined in PeeringServiceProvidersClient. */ +public interface PeeringServiceProvidersClient { + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @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 paginated list of peering service providers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @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 paginated list of peering service providers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringServicesClient.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringServicesClient.java new file mode 100644 index 000000000000..cbbd7b3280ef --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringServicesClient.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.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.peering.fluent.models.PeeringServiceInner; +import com.azure.resourcemanager.peering.models.ResourceTags; + +/** An instance of this class provides access to all the operations defined in PeeringServicesClient. */ +public interface PeeringServicesClient { + /** + * Gets an existing peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing peering service with the specified name under the given subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PeeringServiceInner getByResourceGroup(String resourceGroupName, String peeringServiceName); + + /** + * Gets an existing peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing peering service with the specified name under the given subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String peeringServiceName, Context context); + + /** + * Creates a new peering service or updates an existing peering with the specified name under the given subscription + * and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param peeringService The properties needed to create or update a peering service. + * @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 peering Service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PeeringServiceInner createOrUpdate( + String resourceGroupName, String peeringServiceName, PeeringServiceInner peeringService); + + /** + * Creates a new peering service or updates an existing peering with the specified name under the given subscription + * and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param peeringService The properties needed to create or update a peering service. + * @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 peering Service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String peeringServiceName, PeeringServiceInner peeringService, Context context); + + /** + * Deletes an existing peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String peeringServiceName); + + /** + * Deletes an existing peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String peeringServiceName, Context context); + + /** + * Updates tags for a peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param tags The resource tags. + * @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 peering Service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PeeringServiceInner update(String resourceGroupName, String peeringServiceName, ResourceTags tags); + + /** + * Updates tags for a peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param tags The resource tags. + * @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 peering Service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String peeringServiceName, ResourceTags tags, Context context); + + /** + * Lists all of the peering services under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 paginated list of peering services. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all of the peering services under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 paginated list of peering services. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all of the peerings under the given subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peering services. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the peerings under the given subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peering services. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringsClient.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringsClient.java new file mode 100644 index 000000000000..4813e219c504 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringsClient.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.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.peering.fluent.models.PeeringInner; +import com.azure.resourcemanager.peering.models.ResourceTags; + +/** An instance of this class provides access to all the operations defined in PeeringsClient. */ +public interface PeeringsClient { + /** + * Gets an existing peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing peering with the specified name under the given subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PeeringInner getByResourceGroup(String resourceGroupName, String peeringName); + + /** + * Gets an existing peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing peering with the specified name under the given subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String peeringName, Context context); + + /** + * Creates a new peering or updates an existing peering with the specified name under the given subscription and + * resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param peering The properties needed to create or update a peering. + * @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 peering is a logical representation of a set of connections to the Microsoft Cloud Edge at a location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PeeringInner createOrUpdate(String resourceGroupName, String peeringName, PeeringInner peering); + + /** + * Creates a new peering or updates an existing peering with the specified name under the given subscription and + * resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param peering The properties needed to create or update a peering. + * @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 peering is a logical representation of a set of connections to the Microsoft Cloud Edge at a location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String peeringName, PeeringInner peering, Context context); + + /** + * Deletes an existing peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String peeringName); + + /** + * Deletes an existing peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String peeringName, Context context); + + /** + * Updates tags for a peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param tags The resource tags. + * @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 peering is a logical representation of a set of connections to the Microsoft Cloud Edge at a location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PeeringInner update(String resourceGroupName, String peeringName, ResourceTags tags); + + /** + * Updates tags for a peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param tags The resource tags. + * @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 peering is a logical representation of a set of connections to the Microsoft Cloud Edge at a location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String peeringName, ResourceTags tags, Context context); + + /** + * Lists all of the peerings under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all of the peerings under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all of the peerings under the given subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the peerings under the given subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PrefixesClient.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PrefixesClient.java new file mode 100644 index 000000000000..0722cb0ff5b4 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PrefixesClient.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.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.peering.fluent.models.PeeringServicePrefixInner; + +/** An instance of this class provides access to all the operations defined in PrefixesClient. */ +public interface PrefixesClient { + /** + * Lists the peerings prefix in the resource group. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service 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 paginated list of [T]. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByPeeringService(String resourceGroupName, String peeringServiceName); + + /** + * Lists the peerings prefix in the resource group. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service 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 paginated list of [T]. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByPeeringService( + String resourceGroupName, String peeringServiceName, Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/ResourceProvidersClient.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/ResourceProvidersClient.java new file mode 100644 index 000000000000..1cc121969cb8 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/ResourceProvidersClient.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.peering.models.CheckServiceProviderAvailabilityInput; +import com.azure.resourcemanager.peering.models.Enum0; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public interface ResourceProvidersClient { + /** + * Checks if the peering service provider is present within 1000 miles of customer's location. + * + * @param checkServiceProviderAvailabilityInput The CheckServiceProviderAvailabilityInput indicating customer + * location and service provider. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Enum0 checkServiceProviderAvailability(CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput); + + /** + * Checks if the peering service provider is present within 1000 miles of customer's location. + * + * @param checkServiceProviderAvailabilityInput The CheckServiceProviderAvailabilityInput indicating customer + * location and service provider. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkServiceProviderAvailabilityWithResponse( + CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput, Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/OperationInner.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/OperationInner.java new file mode 100644 index 000000000000..5fad8f5a39bb --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/OperationInner.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.models.OperationDisplayInfo; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The peering API operation. */ +@Immutable +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * The name of the operation. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The information related to the operation. + */ + @JsonProperty(value = "display", access = JsonProperty.Access.WRITE_ONLY) + private OperationDisplayInfo display; + + /* + * The flag that indicates whether the operation applies to data plane. + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /** + * Get the name property: The name of the operation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the display property: The information related to the operation. + * + * @return the display value. + */ + public OperationDisplayInfo display() { + return this.display; + } + + /** + * Get the isDataAction property: The flag that indicates whether the operation applies to data plane. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeerAsnInner.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeerAsnInner.java new file mode 100644 index 000000000000..a0875ff82e1f --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeerAsnInner.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.models.ContactInfo; +import com.azure.resourcemanager.peering.models.ValidationState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The essential information related to the peer's ASN. */ +@JsonFlatten +@Fluent +public class PeerAsnInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeerAsnInner.class); + + /* + * The Autonomous System Number (ASN) of the peer. + */ + @JsonProperty(value = "properties.peerAsn") + private Integer peerAsn; + + /* + * The contact information of the peer. + */ + @JsonProperty(value = "properties.peerContactInfo") + private ContactInfo peerContactInfo; + + /* + * The name of the peer. + */ + @JsonProperty(value = "properties.peerName") + private String peerName; + + /* + * The validation state of the ASN associated with the peer. + */ + @JsonProperty(value = "properties.validationState") + private ValidationState validationState; + + /** + * Get the peerAsn property: The Autonomous System Number (ASN) of the peer. + * + * @return the peerAsn value. + */ + public Integer peerAsn() { + return this.peerAsn; + } + + /** + * Set the peerAsn property: The Autonomous System Number (ASN) of the peer. + * + * @param peerAsn the peerAsn value to set. + * @return the PeerAsnInner object itself. + */ + public PeerAsnInner withPeerAsn(Integer peerAsn) { + this.peerAsn = peerAsn; + return this; + } + + /** + * Get the peerContactInfo property: The contact information of the peer. + * + * @return the peerContactInfo value. + */ + public ContactInfo peerContactInfo() { + return this.peerContactInfo; + } + + /** + * Set the peerContactInfo property: The contact information of the peer. + * + * @param peerContactInfo the peerContactInfo value to set. + * @return the PeerAsnInner object itself. + */ + public PeerAsnInner withPeerContactInfo(ContactInfo peerContactInfo) { + this.peerContactInfo = peerContactInfo; + return this; + } + + /** + * Get the peerName property: The name of the peer. + * + * @return the peerName value. + */ + public String peerName() { + return this.peerName; + } + + /** + * Set the peerName property: The name of the peer. + * + * @param peerName the peerName value to set. + * @return the PeerAsnInner object itself. + */ + public PeerAsnInner withPeerName(String peerName) { + this.peerName = peerName; + return this; + } + + /** + * Get the validationState property: The validation state of the ASN associated with the peer. + * + * @return the validationState value. + */ + public ValidationState validationState() { + return this.validationState; + } + + /** + * Set the validationState property: The validation state of the ASN associated with the peer. + * + * @param validationState the validationState value to set. + * @return the PeerAsnInner object itself. + */ + public PeerAsnInner withValidationState(ValidationState validationState) { + this.validationState = validationState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (peerContactInfo() != null) { + peerContactInfo().validate(); + } + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringInner.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringInner.java new file mode 100644 index 000000000000..0298b3c574ec --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringInner.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.peering.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.models.Kind; +import com.azure.resourcemanager.peering.models.PeeringPropertiesDirect; +import com.azure.resourcemanager.peering.models.PeeringPropertiesExchange; +import com.azure.resourcemanager.peering.models.PeeringSku; +import com.azure.resourcemanager.peering.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Peering is a logical representation of a set of connections to the Microsoft Cloud Edge at a location. */ +@JsonFlatten +@Fluent +public class PeeringInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringInner.class); + + /* + * The SKU that defines the tier and kind of the peering. + */ + @JsonProperty(value = "sku", required = true) + private PeeringSku sku; + + /* + * The kind of the peering. + */ + @JsonProperty(value = "kind", required = true) + private Kind kind; + + /* + * The location of the resource. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /* + * The resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * The properties that define a direct peering. + */ + @JsonProperty(value = "properties.direct") + private PeeringPropertiesDirect direct; + + /* + * The properties that define an exchange peering. + */ + @JsonProperty(value = "properties.exchange") + private PeeringPropertiesExchange exchange; + + /* + * The location of the peering. + */ + @JsonProperty(value = "properties.peeringLocation") + private String peeringLocation; + + /* + * The provisioning state of the resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the sku property: The SKU that defines the tier and kind of the peering. + * + * @return the sku value. + */ + public PeeringSku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU that defines the tier and kind of the peering. + * + * @param sku the sku value to set. + * @return the PeeringInner object itself. + */ + public PeeringInner withSku(PeeringSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the kind property: The kind of the peering. + * + * @return the kind value. + */ + public Kind kind() { + return this.kind; + } + + /** + * Set the kind property: The kind of the peering. + * + * @param kind the kind value to set. + * @return the PeeringInner object itself. + */ + public PeeringInner withKind(Kind kind) { + this.kind = kind; + return this; + } + + /** + * Get the location property: The location of the resource. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location of the resource. + * + * @param location the location value to set. + * @return the PeeringInner object itself. + */ + public PeeringInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags property: The resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The resource tags. + * + * @param tags the tags value to set. + * @return the PeeringInner object itself. + */ + public PeeringInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the direct property: The properties that define a direct peering. + * + * @return the direct value. + */ + public PeeringPropertiesDirect direct() { + return this.direct; + } + + /** + * Set the direct property: The properties that define a direct peering. + * + * @param direct the direct value to set. + * @return the PeeringInner object itself. + */ + public PeeringInner withDirect(PeeringPropertiesDirect direct) { + this.direct = direct; + return this; + } + + /** + * Get the exchange property: The properties that define an exchange peering. + * + * @return the exchange value. + */ + public PeeringPropertiesExchange exchange() { + return this.exchange; + } + + /** + * Set the exchange property: The properties that define an exchange peering. + * + * @param exchange the exchange value to set. + * @return the PeeringInner object itself. + */ + public PeeringInner withExchange(PeeringPropertiesExchange exchange) { + this.exchange = exchange; + return this; + } + + /** + * Get the peeringLocation property: The location of the peering. + * + * @return the peeringLocation value. + */ + public String peeringLocation() { + return this.peeringLocation; + } + + /** + * Set the peeringLocation property: The location of the peering. + * + * @param peeringLocation the peeringLocation value to set. + * @return the PeeringInner object itself. + */ + public PeeringInner withPeeringLocation(String peeringLocation) { + this.peeringLocation = peeringLocation; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property sku in model PeeringInner")); + } else { + sku().validate(); + } + if (kind() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property kind in model PeeringInner")); + } + if (location() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property location in model PeeringInner")); + } + if (direct() != null) { + direct().validate(); + } + if (exchange() != null) { + exchange().validate(); + } + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringLocationInner.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringLocationInner.java new file mode 100644 index 000000000000..66d1113e700a --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringLocationInner.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.models.Kind; +import com.azure.resourcemanager.peering.models.PeeringLocationPropertiesDirect; +import com.azure.resourcemanager.peering.models.PeeringLocationPropertiesExchange; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Peering location is where connectivity could be established to the Microsoft Cloud Edge. */ +@JsonFlatten +@Fluent +public class PeeringLocationInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringLocationInner.class); + + /* + * The kind of peering that the peering location supports. + */ + @JsonProperty(value = "kind") + private Kind kind; + + /* + * The properties that define a direct peering location. + */ + @JsonProperty(value = "properties.direct") + private PeeringLocationPropertiesDirect direct; + + /* + * The properties that define an exchange peering location. + */ + @JsonProperty(value = "properties.exchange") + private PeeringLocationPropertiesExchange exchange; + + /* + * The name of the peering location. + */ + @JsonProperty(value = "properties.peeringLocation") + private String peeringLocation; + + /* + * The country in which the peering location exists. + */ + @JsonProperty(value = "properties.country") + private String country; + + /* + * The Azure region associated with the peering location. + */ + @JsonProperty(value = "properties.azureRegion") + private String azureRegion; + + /** + * Get the kind property: The kind of peering that the peering location supports. + * + * @return the kind value. + */ + public Kind kind() { + return this.kind; + } + + /** + * Set the kind property: The kind of peering that the peering location supports. + * + * @param kind the kind value to set. + * @return the PeeringLocationInner object itself. + */ + public PeeringLocationInner withKind(Kind kind) { + this.kind = kind; + return this; + } + + /** + * Get the direct property: The properties that define a direct peering location. + * + * @return the direct value. + */ + public PeeringLocationPropertiesDirect direct() { + return this.direct; + } + + /** + * Set the direct property: The properties that define a direct peering location. + * + * @param direct the direct value to set. + * @return the PeeringLocationInner object itself. + */ + public PeeringLocationInner withDirect(PeeringLocationPropertiesDirect direct) { + this.direct = direct; + return this; + } + + /** + * Get the exchange property: The properties that define an exchange peering location. + * + * @return the exchange value. + */ + public PeeringLocationPropertiesExchange exchange() { + return this.exchange; + } + + /** + * Set the exchange property: The properties that define an exchange peering location. + * + * @param exchange the exchange value to set. + * @return the PeeringLocationInner object itself. + */ + public PeeringLocationInner withExchange(PeeringLocationPropertiesExchange exchange) { + this.exchange = exchange; + return this; + } + + /** + * Get the peeringLocation property: The name of the peering location. + * + * @return the peeringLocation value. + */ + public String peeringLocation() { + return this.peeringLocation; + } + + /** + * Set the peeringLocation property: The name of the peering location. + * + * @param peeringLocation the peeringLocation value to set. + * @return the PeeringLocationInner object itself. + */ + public PeeringLocationInner withPeeringLocation(String peeringLocation) { + this.peeringLocation = peeringLocation; + return this; + } + + /** + * Get the country property: The country in which the peering location exists. + * + * @return the country value. + */ + public String country() { + return this.country; + } + + /** + * Set the country property: The country in which the peering location exists. + * + * @param country the country value to set. + * @return the PeeringLocationInner object itself. + */ + public PeeringLocationInner withCountry(String country) { + this.country = country; + return this; + } + + /** + * Get the azureRegion property: The Azure region associated with the peering location. + * + * @return the azureRegion value. + */ + public String azureRegion() { + return this.azureRegion; + } + + /** + * Set the azureRegion property: The Azure region associated with the peering location. + * + * @param azureRegion the azureRegion value to set. + * @return the PeeringLocationInner object itself. + */ + public PeeringLocationInner withAzureRegion(String azureRegion) { + this.azureRegion = azureRegion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (direct() != null) { + direct().validate(); + } + if (exchange() != null) { + exchange().validate(); + } + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringServiceInner.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringServiceInner.java new file mode 100644 index 000000000000..60579c680d8a --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringServiceInner.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Peering Service. */ +@JsonFlatten +@Fluent +public class PeeringServiceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringServiceInner.class); + + /* + * The location of the resource. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /* + * The resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * The PeeringServiceLocation of the Customer. + */ + @JsonProperty(value = "properties.peeringServiceLocation") + private String peeringServiceLocation; + + /* + * The MAPS Provider Name. + */ + @JsonProperty(value = "properties.peeringServiceProvider") + private String peeringServiceProvider; + + /* + * The provisioning state of the resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the location property: The location of the resource. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location of the resource. + * + * @param location the location value to set. + * @return the PeeringServiceInner object itself. + */ + public PeeringServiceInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags property: The resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The resource tags. + * + * @param tags the tags value to set. + * @return the PeeringServiceInner object itself. + */ + public PeeringServiceInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the peeringServiceLocation property: The PeeringServiceLocation of the Customer. + * + * @return the peeringServiceLocation value. + */ + public String peeringServiceLocation() { + return this.peeringServiceLocation; + } + + /** + * Set the peeringServiceLocation property: The PeeringServiceLocation of the Customer. + * + * @param peeringServiceLocation the peeringServiceLocation value to set. + * @return the PeeringServiceInner object itself. + */ + public PeeringServiceInner withPeeringServiceLocation(String peeringServiceLocation) { + this.peeringServiceLocation = peeringServiceLocation; + return this; + } + + /** + * Get the peeringServiceProvider property: The MAPS Provider Name. + * + * @return the peeringServiceProvider value. + */ + public String peeringServiceProvider() { + return this.peeringServiceProvider; + } + + /** + * Set the peeringServiceProvider property: The MAPS Provider Name. + * + * @param peeringServiceProvider the peeringServiceProvider value to set. + * @return the PeeringServiceInner object itself. + */ + public PeeringServiceInner withPeeringServiceProvider(String peeringServiceProvider) { + this.peeringServiceProvider = peeringServiceProvider; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (location() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property location in model PeeringServiceInner")); + } + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringServiceLocationInner.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringServiceLocationInner.java new file mode 100644 index 000000000000..01cb8ab58267 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringServiceLocationInner.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** PeeringService location. */ +@JsonFlatten +@Fluent +public class PeeringServiceLocationInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringServiceLocationInner.class); + + /* + * Country of the customer + */ + @JsonProperty(value = "properties.country") + private String country; + + /* + * State of the customer + */ + @JsonProperty(value = "properties.state") + private String state; + + /* + * Azure region for the location + */ + @JsonProperty(value = "properties.azureRegion") + private String azureRegion; + + /** + * Get the country property: Country of the customer. + * + * @return the country value. + */ + public String country() { + return this.country; + } + + /** + * Set the country property: Country of the customer. + * + * @param country the country value to set. + * @return the PeeringServiceLocationInner object itself. + */ + public PeeringServiceLocationInner withCountry(String country) { + this.country = country; + return this; + } + + /** + * Get the state property: State of the customer. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Set the state property: State of the customer. + * + * @param state the state value to set. + * @return the PeeringServiceLocationInner object itself. + */ + public PeeringServiceLocationInner withState(String state) { + this.state = state; + return this; + } + + /** + * Get the azureRegion property: Azure region for the location. + * + * @return the azureRegion value. + */ + public String azureRegion() { + return this.azureRegion; + } + + /** + * Set the azureRegion property: Azure region for the location. + * + * @param azureRegion the azureRegion value to set. + * @return the PeeringServiceLocationInner object itself. + */ + public PeeringServiceLocationInner withAzureRegion(String azureRegion) { + this.azureRegion = azureRegion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringServicePrefixInner.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringServicePrefixInner.java new file mode 100644 index 000000000000..383aa3a0b103 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringServicePrefixInner.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.peering.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.models.LearnedType; +import com.azure.resourcemanager.peering.models.PrefixValidationState; +import com.azure.resourcemanager.peering.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The peering service prefix class. */ +@JsonFlatten +@Fluent +public class PeeringServicePrefixInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringServicePrefixInner.class); + + /* + * Valid route prefix + */ + @JsonProperty(value = "properties.prefix") + private String prefix; + + /* + * The prefix validation state + */ + @JsonProperty(value = "properties.prefixValidationState") + private PrefixValidationState prefixValidationState; + + /* + * The prefix learned type + */ + @JsonProperty(value = "properties.learnedType") + private LearnedType learnedType; + + /* + * The provisioning state of the resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the prefix property: Valid route prefix. + * + * @return the prefix value. + */ + public String prefix() { + return this.prefix; + } + + /** + * Set the prefix property: Valid route prefix. + * + * @param prefix the prefix value to set. + * @return the PeeringServicePrefixInner object itself. + */ + public PeeringServicePrefixInner withPrefix(String prefix) { + this.prefix = prefix; + return this; + } + + /** + * Get the prefixValidationState property: The prefix validation state. + * + * @return the prefixValidationState value. + */ + public PrefixValidationState prefixValidationState() { + return this.prefixValidationState; + } + + /** + * Set the prefixValidationState property: The prefix validation state. + * + * @param prefixValidationState the prefixValidationState value to set. + * @return the PeeringServicePrefixInner object itself. + */ + public PeeringServicePrefixInner withPrefixValidationState(PrefixValidationState prefixValidationState) { + this.prefixValidationState = prefixValidationState; + return this; + } + + /** + * Get the learnedType property: The prefix learned type. + * + * @return the learnedType value. + */ + public LearnedType learnedType() { + return this.learnedType; + } + + /** + * Set the learnedType property: The prefix learned type. + * + * @param learnedType the learnedType value to set. + * @return the PeeringServicePrefixInner object itself. + */ + public PeeringServicePrefixInner withLearnedType(LearnedType learnedType) { + this.learnedType = learnedType; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringServiceProviderInner.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringServiceProviderInner.java new file mode 100644 index 000000000000..850b738ff1e7 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringServiceProviderInner.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.peering.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** PeeringService provider. */ +@JsonFlatten +@Fluent +public class PeeringServiceProviderInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringServiceProviderInner.class); + + /* + * The name of the service provider. + */ + @JsonProperty(value = "properties.serviceProviderName") + private String serviceProviderName; + + /** + * Get the serviceProviderName property: The name of the service provider. + * + * @return the serviceProviderName value. + */ + public String serviceProviderName() { + return this.serviceProviderName; + } + + /** + * Set the serviceProviderName property: The name of the service provider. + * + * @param serviceProviderName the serviceProviderName value to set. + * @return the PeeringServiceProviderInner object itself. + */ + public PeeringServiceProviderInner withServiceProviderName(String serviceProviderName) { + this.serviceProviderName = serviceProviderName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/package-info.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/package-info.java new file mode 100644 index 000000000000..ad3059f785b1 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/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 PeeringManagementClient. Peering Client. */ +package com.azure.resourcemanager.peering.fluent.models; diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/package-info.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/package-info.java new file mode 100644 index 000000000000..fd1155e34f76 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/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 PeeringManagementClient. Peering Client. */ +package com.azure.resourcemanager.peering.fluent; diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/LegacyPeeringsClientImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/LegacyPeeringsClientImpl.java new file mode 100644 index 000000000000..39c706e451f2 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/LegacyPeeringsClientImpl.java @@ -0,0 +1,333 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.fluent.LegacyPeeringsClient; +import com.azure.resourcemanager.peering.fluent.models.PeeringInner; +import com.azure.resourcemanager.peering.models.LegacyPeeringsKind; +import com.azure.resourcemanager.peering.models.PeeringListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LegacyPeeringsClient. */ +public final class LegacyPeeringsClientImpl implements LegacyPeeringsClient { + private final ClientLogger logger = new ClientLogger(LegacyPeeringsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final LegacyPeeringsService service; + + /** The service client containing this operation class. */ + private final PeeringManagementClientImpl client; + + /** + * Initializes an instance of LegacyPeeringsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LegacyPeeringsClientImpl(PeeringManagementClientImpl client) { + this.service = + RestProxy.create(LegacyPeeringsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PeeringManagementClientLegacyPeerings to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PeeringManagementCli") + private interface LegacyPeeringsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Peering/legacyPeerings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("peeringLocation") String peeringLocation, + @QueryParam("kind") LegacyPeeringsKind kind, + @PathParam("subscriptionId") String subscriptionId, + @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 all of the legacy peerings under the given subscription matching the specified kind and location. + * + * @param peeringLocation The location of the peering. + * @param kind The kind of the peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String peeringLocation, LegacyPeeringsKind kind) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (peeringLocation == null) { + return Mono + .error(new IllegalArgumentException("Parameter peeringLocation is required and cannot be null.")); + } + if (kind == null) { + return Mono.error(new IllegalArgumentException("Parameter kind is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + peeringLocation, + kind, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the legacy peerings under the given subscription matching the specified kind and location. + * + * @param peeringLocation The location of the peering. + * @param kind The kind of the peering. + * @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 paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String peeringLocation, LegacyPeeringsKind kind, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (peeringLocation == null) { + return Mono + .error(new IllegalArgumentException("Parameter peeringLocation is required and cannot be null.")); + } + if (kind == null) { + return Mono.error(new IllegalArgumentException("Parameter kind is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + peeringLocation, + kind, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the legacy peerings under the given subscription matching the specified kind and location. + * + * @param peeringLocation The location of the peering. + * @param kind The kind of the peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String peeringLocation, LegacyPeeringsKind kind) { + return new PagedFlux<>( + () -> listSinglePageAsync(peeringLocation, kind), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the legacy peerings under the given subscription matching the specified kind and location. + * + * @param peeringLocation The location of the peering. + * @param kind The kind of the peering. + * @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 paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String peeringLocation, LegacyPeeringsKind kind, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(peeringLocation, kind, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the legacy peerings under the given subscription matching the specified kind and location. + * + * @param peeringLocation The location of the peering. + * @param kind The kind of the peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String peeringLocation, LegacyPeeringsKind kind) { + return new PagedIterable<>(listAsync(peeringLocation, kind)); + } + + /** + * Lists all of the legacy peerings under the given subscription matching the specified kind and location. + * + * @param peeringLocation The location of the peering. + * @param kind The kind of the peering. + * @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 paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String peeringLocation, LegacyPeeringsKind kind, Context context) { + return new PagedIterable<>(listAsync(peeringLocation, kind, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peerings. + */ + @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/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/LegacyPeeringsImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/LegacyPeeringsImpl.java new file mode 100644 index 000000000000..7911f4419542 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/LegacyPeeringsImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.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.peering.fluent.LegacyPeeringsClient; +import com.azure.resourcemanager.peering.fluent.models.PeeringInner; +import com.azure.resourcemanager.peering.models.LegacyPeerings; +import com.azure.resourcemanager.peering.models.LegacyPeeringsKind; +import com.azure.resourcemanager.peering.models.Peering; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class LegacyPeeringsImpl implements LegacyPeerings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LegacyPeeringsImpl.class); + + private final LegacyPeeringsClient innerClient; + + private final com.azure.resourcemanager.peering.PeeringManager serviceManager; + + public LegacyPeeringsImpl( + LegacyPeeringsClient innerClient, com.azure.resourcemanager.peering.PeeringManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String peeringLocation, LegacyPeeringsKind kind) { + PagedIterable inner = this.serviceClient().list(peeringLocation, kind); + return Utils.mapPage(inner, inner1 -> new PeeringImpl(inner1, this.manager())); + } + + public PagedIterable list(String peeringLocation, LegacyPeeringsKind kind, Context context) { + PagedIterable inner = this.serviceClient().list(peeringLocation, kind, context); + return Utils.mapPage(inner, inner1 -> new PeeringImpl(inner1, this.manager())); + } + + private LegacyPeeringsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.peering.PeeringManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/OperationImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/OperationImpl.java new file mode 100644 index 000000000000..2769fb724264 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/OperationImpl.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.implementation; + +import com.azure.resourcemanager.peering.fluent.models.OperationInner; +import com.azure.resourcemanager.peering.models.Operation; +import com.azure.resourcemanager.peering.models.OperationDisplayInfo; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.peering.PeeringManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.peering.PeeringManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplayInfo display() { + return this.innerModel().display(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.peering.PeeringManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/OperationsClientImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..3e0045867d0b --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/OperationsClientImpl.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.fluent.OperationsClient; +import com.azure.resourcemanager.peering.fluent.models.OperationInner; +import com.azure.resourcemanager.peering.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final PeeringManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(PeeringManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PeeringManagementClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PeeringManagementCli") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Peering/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 all of the available API operations for peering resources. + * + * @throws 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 paginated list of peering API operations. + */ + @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 all of the available API operations for peering resources. + * + * @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 paginated list of peering API operations. + */ + @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 all of the available API operations for peering resources. + * + * @throws 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 paginated list of peering API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available API operations for peering resources. + * + * @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 paginated list of peering API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available API operations for peering resources. + * + * @throws 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 paginated list of peering API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available API operations for peering resources. + * + * @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 paginated list of peering API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peering API operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peering API operations. + */ + @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/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/OperationsImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/OperationsImpl.java new file mode 100644 index 000000000000..4bb8c597a92c --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/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.peering.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.peering.fluent.OperationsClient; +import com.azure.resourcemanager.peering.fluent.models.OperationInner; +import com.azure.resourcemanager.peering.models.Operation; +import com.azure.resourcemanager.peering.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.peering.PeeringManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.peering.PeeringManager 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.peering.PeeringManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeerAsnImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeerAsnImpl.java new file mode 100644 index 000000000000..dadf641455a7 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeerAsnImpl.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.peering.fluent.models.PeerAsnInner; +import com.azure.resourcemanager.peering.models.ContactInfo; +import com.azure.resourcemanager.peering.models.PeerAsn; +import com.azure.resourcemanager.peering.models.ValidationState; + +public final class PeerAsnImpl implements PeerAsn, PeerAsn.Definition, PeerAsn.Update { + private PeerAsnInner innerObject; + + private final com.azure.resourcemanager.peering.PeeringManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Integer peerAsn() { + return this.innerModel().peerAsn(); + } + + public ContactInfo peerContactInfo() { + return this.innerModel().peerContactInfo(); + } + + public String peerName() { + return this.innerModel().peerName(); + } + + public ValidationState validationState() { + return this.innerModel().validationState(); + } + + public PeerAsnInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.peering.PeeringManager manager() { + return this.serviceManager; + } + + private String peerAsnName; + + public PeerAsn create() { + this.innerObject = + serviceManager + .serviceClient() + .getPeerAsns() + .createOrUpdateWithResponse(peerAsnName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public PeerAsn create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPeerAsns() + .createOrUpdateWithResponse(peerAsnName, this.innerModel(), context) + .getValue(); + return this; + } + + PeerAsnImpl(String name, com.azure.resourcemanager.peering.PeeringManager serviceManager) { + this.innerObject = new PeerAsnInner(); + this.serviceManager = serviceManager; + this.peerAsnName = name; + } + + public PeerAsnImpl update() { + return this; + } + + public PeerAsn apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPeerAsns() + .createOrUpdateWithResponse(peerAsnName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public PeerAsn apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPeerAsns() + .createOrUpdateWithResponse(peerAsnName, this.innerModel(), context) + .getValue(); + return this; + } + + PeerAsnImpl(PeerAsnInner innerObject, com.azure.resourcemanager.peering.PeeringManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.peerAsnName = Utils.getValueFromIdByName(innerObject.id(), "peerAsns"); + } + + public PeerAsn refresh() { + this.innerObject = + serviceManager.serviceClient().getPeerAsns().getWithResponse(peerAsnName, Context.NONE).getValue(); + return this; + } + + public PeerAsn refresh(Context context) { + this.innerObject = + serviceManager.serviceClient().getPeerAsns().getWithResponse(peerAsnName, context).getValue(); + return this; + } + + public PeerAsnImpl withPeerAsn(Integer peerAsn) { + this.innerModel().withPeerAsn(peerAsn); + return this; + } + + public PeerAsnImpl withPeerContactInfo(ContactInfo peerContactInfo) { + this.innerModel().withPeerContactInfo(peerContactInfo); + return this; + } + + public PeerAsnImpl withPeerName(String peerName) { + this.innerModel().withPeerName(peerName); + return this; + } + + public PeerAsnImpl withValidationState(ValidationState validationState) { + this.innerModel().withValidationState(validationState); + return this; + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeerAsnsClientImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeerAsnsClientImpl.java new file mode 100644 index 000000000000..13175882e076 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeerAsnsClientImpl.java @@ -0,0 +1,738 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.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.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.fluent.PeerAsnsClient; +import com.azure.resourcemanager.peering.fluent.models.PeerAsnInner; +import com.azure.resourcemanager.peering.models.PeerAsnListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PeerAsnsClient. */ +public final class PeerAsnsClientImpl implements PeerAsnsClient { + private final ClientLogger logger = new ClientLogger(PeerAsnsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PeerAsnsService service; + + /** The service client containing this operation class. */ + private final PeeringManagementClientImpl client; + + /** + * Initializes an instance of PeerAsnsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PeerAsnsClientImpl(PeeringManagementClientImpl client) { + this.service = RestProxy.create(PeerAsnsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PeeringManagementClientPeerAsns to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PeeringManagementCli") + private interface PeerAsnsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/{peerAsnName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("peerAsnName") String peerAsnName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/{peerAsnName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("peerAsnName") String peerAsnName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PeerAsnInner peerAsn, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/{peerAsnName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("peerAsnName") String peerAsnName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN 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 peer ASN with the specified name under the given subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String peerAsnName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (peerAsnName == null) { + return Mono.error(new IllegalArgumentException("Parameter peerAsnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + peerAsnName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN 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 peer ASN with the specified name under the given subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String peerAsnName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (peerAsnName == null) { + return Mono.error(new IllegalArgumentException("Parameter peerAsnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + peerAsnName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN 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 peer ASN with the specified name under the given subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String peerAsnName) { + return getWithResponseAsync(peerAsnName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN 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 peer ASN with the specified name under the given subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PeerAsnInner get(String peerAsnName) { + return getAsync(peerAsnName).block(); + } + + /** + * Gets the peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN 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 peer ASN with the specified name under the given subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String peerAsnName, Context context) { + return getWithResponseAsync(peerAsnName, context).block(); + } + + /** + * Creates a new peer ASN or updates an existing peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN name. + * @param peerAsn The peer ASN. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 essential information related to the peer's ASN. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String peerAsnName, PeerAsnInner peerAsn) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (peerAsnName == null) { + return Mono.error(new IllegalArgumentException("Parameter peerAsnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (peerAsn == null) { + return Mono.error(new IllegalArgumentException("Parameter peerAsn is required and cannot be null.")); + } else { + peerAsn.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + peerAsnName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + peerAsn, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a new peer ASN or updates an existing peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN name. + * @param peerAsn The peer ASN. + * @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 essential information related to the peer's ASN. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String peerAsnName, PeerAsnInner peerAsn, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (peerAsnName == null) { + return Mono.error(new IllegalArgumentException("Parameter peerAsnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (peerAsn == null) { + return Mono.error(new IllegalArgumentException("Parameter peerAsn is required and cannot be null.")); + } else { + peerAsn.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + peerAsnName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + peerAsn, + accept, + context); + } + + /** + * Creates a new peer ASN or updates an existing peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN name. + * @param peerAsn The peer ASN. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 essential information related to the peer's ASN. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String peerAsnName, PeerAsnInner peerAsn) { + return createOrUpdateWithResponseAsync(peerAsnName, peerAsn) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates a new peer ASN or updates an existing peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN name. + * @param peerAsn The peer ASN. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 essential information related to the peer's ASN. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PeerAsnInner createOrUpdate(String peerAsnName, PeerAsnInner peerAsn) { + return createOrUpdateAsync(peerAsnName, peerAsn).block(); + } + + /** + * Creates a new peer ASN or updates an existing peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN name. + * @param peerAsn The peer ASN. + * @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 essential information related to the peer's ASN. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String peerAsnName, PeerAsnInner peerAsn, Context context) { + return createOrUpdateWithResponseAsync(peerAsnName, peerAsn, context).block(); + } + + /** + * Deletes an existing peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String peerAsnName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (peerAsnName == null) { + return Mono.error(new IllegalArgumentException("Parameter peerAsnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + peerAsnName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String peerAsnName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (peerAsnName == null) { + return Mono.error(new IllegalArgumentException("Parameter peerAsnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + peerAsnName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes an existing peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String peerAsnName) { + return deleteWithResponseAsync(peerAsnName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes an existing peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN 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 peerAsnName) { + deleteAsync(peerAsnName).block(); + } + + /** + * Deletes an existing peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String peerAsnName, Context context) { + return deleteWithResponseAsync(peerAsnName, context).block(); + } + + /** + * Lists all of the peer ASNs under the given subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peer ASNs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the peer ASNs under the given subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peer ASNs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the peer ASNs under the given subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peer ASNs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the peer ASNs under the given subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peer ASNs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the peer ASNs under the given subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peer ASNs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the peer ASNs under the given subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peer ASNs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peer ASNs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(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.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peer ASNs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(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 + .listBySubscriptionNext(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/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeerAsnsImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeerAsnsImpl.java new file mode 100644 index 000000000000..bbe273940b48 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeerAsnsImpl.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.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.peering.fluent.PeerAsnsClient; +import com.azure.resourcemanager.peering.fluent.models.PeerAsnInner; +import com.azure.resourcemanager.peering.models.PeerAsn; +import com.azure.resourcemanager.peering.models.PeerAsns; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PeerAsnsImpl implements PeerAsns { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeerAsnsImpl.class); + + private final PeerAsnsClient innerClient; + + private final com.azure.resourcemanager.peering.PeeringManager serviceManager; + + public PeerAsnsImpl(PeerAsnsClient innerClient, com.azure.resourcemanager.peering.PeeringManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PeerAsn get(String peerAsnName) { + PeerAsnInner inner = this.serviceClient().get(peerAsnName); + if (inner != null) { + return new PeerAsnImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String peerAsnName, Context context) { + Response inner = this.serviceClient().getWithResponse(peerAsnName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PeerAsnImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String peerAsnName) { + this.serviceClient().delete(peerAsnName); + } + + public Response deleteWithResponse(String peerAsnName, Context context) { + return this.serviceClient().deleteWithResponse(peerAsnName, context); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new PeerAsnImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new PeerAsnImpl(inner1, this.manager())); + } + + public PeerAsn getById(String id) { + String peerAsnName = Utils.getValueFromIdByName(id, "peerAsns"); + if (peerAsnName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'peerAsns'.", id))); + } + return this.getWithResponse(peerAsnName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String peerAsnName = Utils.getValueFromIdByName(id, "peerAsns"); + if (peerAsnName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'peerAsns'.", id))); + } + return this.getWithResponse(peerAsnName, context); + } + + public void deleteById(String id) { + String peerAsnName = Utils.getValueFromIdByName(id, "peerAsns"); + if (peerAsnName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'peerAsns'.", id))); + } + this.deleteWithResponse(peerAsnName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String peerAsnName = Utils.getValueFromIdByName(id, "peerAsns"); + if (peerAsnName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'peerAsns'.", id))); + } + return this.deleteWithResponse(peerAsnName, context); + } + + private PeerAsnsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.peering.PeeringManager manager() { + return this.serviceManager; + } + + public PeerAsnImpl define(String name) { + return new PeerAsnImpl(name, this.manager()); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringImpl.java new file mode 100644 index 000000000000..d590f8d0e81d --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringImpl.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.peering.fluent.models.PeeringInner; +import com.azure.resourcemanager.peering.models.Kind; +import com.azure.resourcemanager.peering.models.Peering; +import com.azure.resourcemanager.peering.models.PeeringPropertiesDirect; +import com.azure.resourcemanager.peering.models.PeeringPropertiesExchange; +import com.azure.resourcemanager.peering.models.PeeringSku; +import com.azure.resourcemanager.peering.models.ProvisioningState; +import com.azure.resourcemanager.peering.models.ResourceTags; +import java.util.Collections; +import java.util.Map; + +public final class PeeringImpl implements Peering, Peering.Definition, Peering.Update { + private PeeringInner innerObject; + + private final com.azure.resourcemanager.peering.PeeringManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PeeringSku sku() { + return this.innerModel().sku(); + } + + public Kind kind() { + return this.innerModel().kind(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public PeeringPropertiesDirect direct() { + return this.innerModel().direct(); + } + + public PeeringPropertiesExchange exchange() { + return this.innerModel().exchange(); + } + + public String peeringLocation() { + return this.innerModel().peeringLocation(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public PeeringInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.peering.PeeringManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String peeringName; + + private ResourceTags updateTags; + + public PeeringImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Peering create() { + this.innerObject = + serviceManager + .serviceClient() + .getPeerings() + .createOrUpdateWithResponse(resourceGroupName, peeringName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Peering create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPeerings() + .createOrUpdateWithResponse(resourceGroupName, peeringName, this.innerModel(), context) + .getValue(); + return this; + } + + PeeringImpl(String name, com.azure.resourcemanager.peering.PeeringManager serviceManager) { + this.innerObject = new PeeringInner(); + this.serviceManager = serviceManager; + this.peeringName = name; + } + + public PeeringImpl update() { + this.updateTags = new ResourceTags(); + return this; + } + + public Peering apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPeerings() + .updateWithResponse(resourceGroupName, peeringName, updateTags, Context.NONE) + .getValue(); + return this; + } + + public Peering apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPeerings() + .updateWithResponse(resourceGroupName, peeringName, updateTags, context) + .getValue(); + return this; + } + + PeeringImpl(PeeringInner innerObject, com.azure.resourcemanager.peering.PeeringManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.peeringName = Utils.getValueFromIdByName(innerObject.id(), "peerings"); + } + + public Peering refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPeerings() + .getByResourceGroupWithResponse(resourceGroupName, peeringName, Context.NONE) + .getValue(); + return this; + } + + public Peering refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPeerings() + .getByResourceGroupWithResponse(resourceGroupName, peeringName, context) + .getValue(); + return this; + } + + public PeeringImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public PeeringImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public PeeringImpl withSku(PeeringSku sku) { + this.innerModel().withSku(sku); + return this; + } + + public PeeringImpl withKind(Kind kind) { + this.innerModel().withKind(kind); + return this; + } + + public PeeringImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateTags.withTags(tags); + return this; + } + } + + public PeeringImpl withDirect(PeeringPropertiesDirect direct) { + this.innerModel().withDirect(direct); + return this; + } + + public PeeringImpl withExchange(PeeringPropertiesExchange exchange) { + this.innerModel().withExchange(exchange); + return this; + } + + public PeeringImpl withPeeringLocation(String peeringLocation) { + this.innerModel().withPeeringLocation(peeringLocation); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringLocationImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringLocationImpl.java new file mode 100644 index 000000000000..eb4ff8a596f9 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringLocationImpl.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.implementation; + +import com.azure.resourcemanager.peering.fluent.models.PeeringLocationInner; +import com.azure.resourcemanager.peering.models.Kind; +import com.azure.resourcemanager.peering.models.PeeringLocation; +import com.azure.resourcemanager.peering.models.PeeringLocationPropertiesDirect; +import com.azure.resourcemanager.peering.models.PeeringLocationPropertiesExchange; + +public final class PeeringLocationImpl implements PeeringLocation { + private PeeringLocationInner innerObject; + + private final com.azure.resourcemanager.peering.PeeringManager serviceManager; + + PeeringLocationImpl( + PeeringLocationInner innerObject, com.azure.resourcemanager.peering.PeeringManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Kind kind() { + return this.innerModel().kind(); + } + + public PeeringLocationPropertiesDirect direct() { + return this.innerModel().direct(); + } + + public PeeringLocationPropertiesExchange exchange() { + return this.innerModel().exchange(); + } + + public String peeringLocation() { + return this.innerModel().peeringLocation(); + } + + public String country() { + return this.innerModel().country(); + } + + public String azureRegion() { + return this.innerModel().azureRegion(); + } + + public PeeringLocationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.peering.PeeringManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringLocationsClientImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringLocationsClientImpl.java new file mode 100644 index 000000000000..b4d4102365b6 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringLocationsClientImpl.java @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.fluent.PeeringLocationsClient; +import com.azure.resourcemanager.peering.fluent.models.PeeringLocationInner; +import com.azure.resourcemanager.peering.models.PeeringLocationListResult; +import com.azure.resourcemanager.peering.models.PeeringLocationsDirectPeeringType; +import com.azure.resourcemanager.peering.models.PeeringLocationsKind; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PeeringLocationsClient. */ +public final class PeeringLocationsClientImpl implements PeeringLocationsClient { + private final ClientLogger logger = new ClientLogger(PeeringLocationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PeeringLocationsService service; + + /** The service client containing this operation class. */ + private final PeeringManagementClientImpl client; + + /** + * Initializes an instance of PeeringLocationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PeeringLocationsClientImpl(PeeringManagementClientImpl client) { + this.service = + RestProxy.create(PeeringLocationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PeeringManagementClientPeeringLocations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PeeringManagementCli") + private interface PeeringLocationsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringLocations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("kind") PeeringLocationsKind kind, + @QueryParam("directPeeringType") PeeringLocationsDirectPeeringType directPeeringType, + @PathParam("subscriptionId") String subscriptionId, + @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 all of the available peering locations for the specified kind of peering. + * + * @param kind The kind of the peering. + * @param directPeeringType The type of direct peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 paginated list of peering locations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + PeeringLocationsKind kind, PeeringLocationsDirectPeeringType directPeeringType) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (kind == null) { + return Mono.error(new IllegalArgumentException("Parameter kind is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + kind, + directPeeringType, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the available peering locations for the specified kind of peering. + * + * @param kind The kind of the peering. + * @param directPeeringType The type of direct peering. + * @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 paginated list of peering locations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + PeeringLocationsKind kind, PeeringLocationsDirectPeeringType directPeeringType, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (kind == null) { + return Mono.error(new IllegalArgumentException("Parameter kind is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + kind, + directPeeringType, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the available peering locations for the specified kind of peering. + * + * @param kind The kind of the peering. + * @param directPeeringType The type of direct peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 paginated list of peering locations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + PeeringLocationsKind kind, PeeringLocationsDirectPeeringType directPeeringType) { + return new PagedFlux<>( + () -> listSinglePageAsync(kind, directPeeringType), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available peering locations for the specified kind of peering. + * + * @param kind The kind of the peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 paginated list of peering locations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(PeeringLocationsKind kind) { + final PeeringLocationsDirectPeeringType directPeeringType = null; + return new PagedFlux<>( + () -> listSinglePageAsync(kind, directPeeringType), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available peering locations for the specified kind of peering. + * + * @param kind The kind of the peering. + * @param directPeeringType The type of direct peering. + * @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 paginated list of peering locations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + PeeringLocationsKind kind, PeeringLocationsDirectPeeringType directPeeringType, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(kind, directPeeringType, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available peering locations for the specified kind of peering. + * + * @param kind The kind of the peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 paginated list of peering locations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(PeeringLocationsKind kind) { + final PeeringLocationsDirectPeeringType directPeeringType = null; + return new PagedIterable<>(listAsync(kind, directPeeringType)); + } + + /** + * Lists all of the available peering locations for the specified kind of peering. + * + * @param kind The kind of the peering. + * @param directPeeringType The type of direct peering. + * @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 paginated list of peering locations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + PeeringLocationsKind kind, PeeringLocationsDirectPeeringType directPeeringType, Context context) { + return new PagedIterable<>(listAsync(kind, directPeeringType, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peering locations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peering locations. + */ + @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/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringLocationsImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringLocationsImpl.java new file mode 100644 index 000000000000..1bbfd5b794eb --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringLocationsImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.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.peering.fluent.PeeringLocationsClient; +import com.azure.resourcemanager.peering.fluent.models.PeeringLocationInner; +import com.azure.resourcemanager.peering.models.PeeringLocation; +import com.azure.resourcemanager.peering.models.PeeringLocations; +import com.azure.resourcemanager.peering.models.PeeringLocationsDirectPeeringType; +import com.azure.resourcemanager.peering.models.PeeringLocationsKind; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PeeringLocationsImpl implements PeeringLocations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringLocationsImpl.class); + + private final PeeringLocationsClient innerClient; + + private final com.azure.resourcemanager.peering.PeeringManager serviceManager; + + public PeeringLocationsImpl( + PeeringLocationsClient innerClient, com.azure.resourcemanager.peering.PeeringManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(PeeringLocationsKind kind) { + PagedIterable inner = this.serviceClient().list(kind); + return Utils.mapPage(inner, inner1 -> new PeeringLocationImpl(inner1, this.manager())); + } + + public PagedIterable list( + PeeringLocationsKind kind, PeeringLocationsDirectPeeringType directPeeringType, Context context) { + PagedIterable inner = this.serviceClient().list(kind, directPeeringType, context); + return Utils.mapPage(inner, inner1 -> new PeeringLocationImpl(inner1, this.manager())); + } + + private PeeringLocationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.peering.PeeringManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringManagementClientBuilder.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringManagementClientBuilder.java new file mode 100644 index 000000000000..ac626dc5337d --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringManagementClientBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the PeeringManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {PeeringManagementClientImpl.class}) +public final class PeeringManagementClientBuilder { + /* + * The Azure subscription ID. + */ + private String subscriptionId; + + /** + * Sets The Azure subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the PeeringManagementClientBuilder. + */ + public PeeringManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the PeeringManagementClientBuilder. + */ + public PeeringManagementClientBuilder 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 PeeringManagementClientBuilder. + */ + public PeeringManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the PeeringManagementClientBuilder. + */ + public PeeringManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the PeeringManagementClientBuilder. + */ + public PeeringManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the PeeringManagementClientBuilder. + */ + public PeeringManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of PeeringManagementClientImpl with the provided parameters. + * + * @return an instance of PeeringManagementClientImpl. + */ + public PeeringManagementClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + PeeringManagementClientImpl client = + new PeeringManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringManagementClientImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringManagementClientImpl.java new file mode 100644 index 000000000000..e7b8b9e33be0 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringManagementClientImpl.java @@ -0,0 +1,433 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.peering.fluent.LegacyPeeringsClient; +import com.azure.resourcemanager.peering.fluent.OperationsClient; +import com.azure.resourcemanager.peering.fluent.PeerAsnsClient; +import com.azure.resourcemanager.peering.fluent.PeeringLocationsClient; +import com.azure.resourcemanager.peering.fluent.PeeringManagementClient; +import com.azure.resourcemanager.peering.fluent.PeeringServiceLocationsClient; +import com.azure.resourcemanager.peering.fluent.PeeringServicePrefixesClient; +import com.azure.resourcemanager.peering.fluent.PeeringServiceProvidersClient; +import com.azure.resourcemanager.peering.fluent.PeeringServicesClient; +import com.azure.resourcemanager.peering.fluent.PeeringsClient; +import com.azure.resourcemanager.peering.fluent.PrefixesClient; +import com.azure.resourcemanager.peering.fluent.ResourceProvidersClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the PeeringManagementClientImpl type. */ +@ServiceClient(builder = PeeringManagementClientBuilder.class) +public final class PeeringManagementClientImpl implements PeeringManagementClient { + private final ClientLogger logger = new ClientLogger(PeeringManagementClientImpl.class); + + /** The Azure subscription ID. */ + private final String subscriptionId; + + /** + * Gets The Azure subscription ID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The ResourceProvidersClient object to access its operations. */ + private final ResourceProvidersClient resourceProviders; + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; + } + + /** The LegacyPeeringsClient object to access its operations. */ + private final LegacyPeeringsClient legacyPeerings; + + /** + * Gets the LegacyPeeringsClient object to access its operations. + * + * @return the LegacyPeeringsClient object. + */ + public LegacyPeeringsClient getLegacyPeerings() { + return this.legacyPeerings; + } + + /** 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 PeerAsnsClient object to access its operations. */ + private final PeerAsnsClient peerAsns; + + /** + * Gets the PeerAsnsClient object to access its operations. + * + * @return the PeerAsnsClient object. + */ + public PeerAsnsClient getPeerAsns() { + return this.peerAsns; + } + + /** The PeeringLocationsClient object to access its operations. */ + private final PeeringLocationsClient peeringLocations; + + /** + * Gets the PeeringLocationsClient object to access its operations. + * + * @return the PeeringLocationsClient object. + */ + public PeeringLocationsClient getPeeringLocations() { + return this.peeringLocations; + } + + /** The PeeringsClient object to access its operations. */ + private final PeeringsClient peerings; + + /** + * Gets the PeeringsClient object to access its operations. + * + * @return the PeeringsClient object. + */ + public PeeringsClient getPeerings() { + return this.peerings; + } + + /** The PeeringServiceLocationsClient object to access its operations. */ + private final PeeringServiceLocationsClient peeringServiceLocations; + + /** + * Gets the PeeringServiceLocationsClient object to access its operations. + * + * @return the PeeringServiceLocationsClient object. + */ + public PeeringServiceLocationsClient getPeeringServiceLocations() { + return this.peeringServiceLocations; + } + + /** The PeeringServicePrefixesClient object to access its operations. */ + private final PeeringServicePrefixesClient peeringServicePrefixes; + + /** + * Gets the PeeringServicePrefixesClient object to access its operations. + * + * @return the PeeringServicePrefixesClient object. + */ + public PeeringServicePrefixesClient getPeeringServicePrefixes() { + return this.peeringServicePrefixes; + } + + /** The PrefixesClient object to access its operations. */ + private final PrefixesClient prefixes; + + /** + * Gets the PrefixesClient object to access its operations. + * + * @return the PrefixesClient object. + */ + public PrefixesClient getPrefixes() { + return this.prefixes; + } + + /** The PeeringServiceProvidersClient object to access its operations. */ + private final PeeringServiceProvidersClient peeringServiceProviders; + + /** + * Gets the PeeringServiceProvidersClient object to access its operations. + * + * @return the PeeringServiceProvidersClient object. + */ + public PeeringServiceProvidersClient getPeeringServiceProviders() { + return this.peeringServiceProviders; + } + + /** The PeeringServicesClient object to access its operations. */ + private final PeeringServicesClient peeringServices; + + /** + * Gets the PeeringServicesClient object to access its operations. + * + * @return the PeeringServicesClient object. + */ + public PeeringServicesClient getPeeringServices() { + return this.peeringServices; + } + + /** + * Initializes an instance of PeeringManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The Azure subscription ID. + * @param endpoint server parameter. + */ + PeeringManagementClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2019-08-01-preview"; + this.resourceProviders = new ResourceProvidersClientImpl(this); + this.legacyPeerings = new LegacyPeeringsClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.peerAsns = new PeerAsnsClientImpl(this); + this.peeringLocations = new PeeringLocationsClientImpl(this); + this.peerings = new PeeringsClientImpl(this); + this.peeringServiceLocations = new PeeringServiceLocationsClientImpl(this); + this.peeringServicePrefixes = new PeeringServicePrefixesClientImpl(this); + this.prefixes = new PrefixesClientImpl(this); + this.peeringServiceProviders = new PeeringServiceProvidersClientImpl(this); + this.peeringServices = new PeeringServicesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceImpl.java new file mode 100644 index 000000000000..b5eb5d342e56 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceImpl.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.peering.fluent.models.PeeringServiceInner; +import com.azure.resourcemanager.peering.models.PeeringService; +import com.azure.resourcemanager.peering.models.ProvisioningState; +import com.azure.resourcemanager.peering.models.ResourceTags; +import java.util.Collections; +import java.util.Map; + +public final class PeeringServiceImpl implements PeeringService, PeeringService.Definition, PeeringService.Update { + private PeeringServiceInner innerObject; + + private final com.azure.resourcemanager.peering.PeeringManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String peeringServiceLocation() { + return this.innerModel().peeringServiceLocation(); + } + + public String peeringServiceProvider() { + return this.innerModel().peeringServiceProvider(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public PeeringServiceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.peering.PeeringManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String peeringServiceName; + + private ResourceTags updateTags; + + public PeeringServiceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public PeeringService create() { + this.innerObject = + serviceManager + .serviceClient() + .getPeeringServices() + .createOrUpdateWithResponse(resourceGroupName, peeringServiceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public PeeringService create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPeeringServices() + .createOrUpdateWithResponse(resourceGroupName, peeringServiceName, this.innerModel(), context) + .getValue(); + return this; + } + + PeeringServiceImpl(String name, com.azure.resourcemanager.peering.PeeringManager serviceManager) { + this.innerObject = new PeeringServiceInner(); + this.serviceManager = serviceManager; + this.peeringServiceName = name; + } + + public PeeringServiceImpl update() { + this.updateTags = new ResourceTags(); + return this; + } + + public PeeringService apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPeeringServices() + .updateWithResponse(resourceGroupName, peeringServiceName, updateTags, Context.NONE) + .getValue(); + return this; + } + + public PeeringService apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPeeringServices() + .updateWithResponse(resourceGroupName, peeringServiceName, updateTags, context) + .getValue(); + return this; + } + + PeeringServiceImpl( + PeeringServiceInner innerObject, com.azure.resourcemanager.peering.PeeringManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.peeringServiceName = Utils.getValueFromIdByName(innerObject.id(), "peeringServices"); + } + + public PeeringService refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPeeringServices() + .getByResourceGroupWithResponse(resourceGroupName, peeringServiceName, Context.NONE) + .getValue(); + return this; + } + + public PeeringService refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPeeringServices() + .getByResourceGroupWithResponse(resourceGroupName, peeringServiceName, context) + .getValue(); + return this; + } + + public PeeringServiceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public PeeringServiceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public PeeringServiceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateTags.withTags(tags); + return this; + } + } + + public PeeringServiceImpl withPeeringServiceLocation(String peeringServiceLocation) { + this.innerModel().withPeeringServiceLocation(peeringServiceLocation); + return this; + } + + public PeeringServiceImpl withPeeringServiceProvider(String peeringServiceProvider) { + this.innerModel().withPeeringServiceProvider(peeringServiceProvider); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceLocationImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceLocationImpl.java new file mode 100644 index 000000000000..ad3f9192277d --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceLocationImpl.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.peering.implementation; + +import com.azure.resourcemanager.peering.fluent.models.PeeringServiceLocationInner; +import com.azure.resourcemanager.peering.models.PeeringServiceLocation; + +public final class PeeringServiceLocationImpl implements PeeringServiceLocation { + private PeeringServiceLocationInner innerObject; + + private final com.azure.resourcemanager.peering.PeeringManager serviceManager; + + PeeringServiceLocationImpl( + PeeringServiceLocationInner innerObject, com.azure.resourcemanager.peering.PeeringManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String country() { + return this.innerModel().country(); + } + + public String state() { + return this.innerModel().state(); + } + + public String azureRegion() { + return this.innerModel().azureRegion(); + } + + public PeeringServiceLocationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.peering.PeeringManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceLocationsClientImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceLocationsClientImpl.java new file mode 100644 index 000000000000..61e1d3aa00e8 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceLocationsClientImpl.java @@ -0,0 +1,295 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.fluent.PeeringServiceLocationsClient; +import com.azure.resourcemanager.peering.fluent.models.PeeringServiceLocationInner; +import com.azure.resourcemanager.peering.models.PeeringServiceLocationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PeeringServiceLocationsClient. */ +public final class PeeringServiceLocationsClientImpl implements PeeringServiceLocationsClient { + private final ClientLogger logger = new ClientLogger(PeeringServiceLocationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PeeringServiceLocationsService service; + + /** The service client containing this operation class. */ + private final PeeringManagementClientImpl client; + + /** + * Initializes an instance of PeeringServiceLocationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PeeringServiceLocationsClientImpl(PeeringManagementClientImpl client) { + this.service = + RestProxy + .create(PeeringServiceLocationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PeeringManagementClientPeeringServiceLocations to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PeeringManagementCli") + private interface PeeringServiceLocationsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceLocations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @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 all of the available peering service locations for the specified kind of peering. + * + * @throws 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 paginated list of peering service locations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @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 paginated list of peering service locations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @throws 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 paginated list of peering service locations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @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 paginated list of peering service locations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @throws 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 paginated list of peering service locations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @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 paginated list of peering service locations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peering service locations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peering service locations. + */ + @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/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceLocationsImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceLocationsImpl.java new file mode 100644 index 000000000000..4156a11b36e0 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceLocationsImpl.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.peering.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.peering.fluent.PeeringServiceLocationsClient; +import com.azure.resourcemanager.peering.fluent.models.PeeringServiceLocationInner; +import com.azure.resourcemanager.peering.models.PeeringServiceLocation; +import com.azure.resourcemanager.peering.models.PeeringServiceLocations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PeeringServiceLocationsImpl implements PeeringServiceLocations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringServiceLocationsImpl.class); + + private final PeeringServiceLocationsClient innerClient; + + private final com.azure.resourcemanager.peering.PeeringManager serviceManager; + + public PeeringServiceLocationsImpl( + PeeringServiceLocationsClient innerClient, com.azure.resourcemanager.peering.PeeringManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new PeeringServiceLocationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new PeeringServiceLocationImpl(inner1, this.manager())); + } + + private PeeringServiceLocationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.peering.PeeringManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServicePrefixImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServicePrefixImpl.java new file mode 100644 index 000000000000..3cd6540144c6 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServicePrefixImpl.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.peering.fluent.models.PeeringServicePrefixInner; +import com.azure.resourcemanager.peering.models.LearnedType; +import com.azure.resourcemanager.peering.models.PeeringServicePrefix; +import com.azure.resourcemanager.peering.models.PrefixValidationState; +import com.azure.resourcemanager.peering.models.ProvisioningState; + +public final class PeeringServicePrefixImpl + implements PeeringServicePrefix, PeeringServicePrefix.Definition, PeeringServicePrefix.Update { + private PeeringServicePrefixInner innerObject; + + private final com.azure.resourcemanager.peering.PeeringManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String prefix() { + return this.innerModel().prefix(); + } + + public PrefixValidationState prefixValidationState() { + return this.innerModel().prefixValidationState(); + } + + public LearnedType learnedType() { + return this.innerModel().learnedType(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public PeeringServicePrefixInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.peering.PeeringManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String peeringServiceName; + + private String prefixName; + + public PeeringServicePrefixImpl withExistingPeeringService(String resourceGroupName, String peeringServiceName) { + this.resourceGroupName = resourceGroupName; + this.peeringServiceName = peeringServiceName; + return this; + } + + public PeeringServicePrefix create() { + this.innerObject = + serviceManager + .serviceClient() + .getPeeringServicePrefixes() + .createOrUpdateWithResponse( + resourceGroupName, peeringServiceName, prefixName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public PeeringServicePrefix create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPeeringServicePrefixes() + .createOrUpdateWithResponse( + resourceGroupName, peeringServiceName, prefixName, this.innerModel(), context) + .getValue(); + return this; + } + + PeeringServicePrefixImpl(String name, com.azure.resourcemanager.peering.PeeringManager serviceManager) { + this.innerObject = new PeeringServicePrefixInner(); + this.serviceManager = serviceManager; + this.prefixName = name; + } + + public PeeringServicePrefixImpl update() { + return this; + } + + public PeeringServicePrefix apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPeeringServicePrefixes() + .createOrUpdateWithResponse( + resourceGroupName, peeringServiceName, prefixName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public PeeringServicePrefix apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPeeringServicePrefixes() + .createOrUpdateWithResponse( + resourceGroupName, peeringServiceName, prefixName, this.innerModel(), context) + .getValue(); + return this; + } + + PeeringServicePrefixImpl( + PeeringServicePrefixInner innerObject, com.azure.resourcemanager.peering.PeeringManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.peeringServiceName = Utils.getValueFromIdByName(innerObject.id(), "peeringServices"); + this.prefixName = Utils.getValueFromIdByName(innerObject.id(), "prefixes"); + } + + public PeeringServicePrefix refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPeeringServicePrefixes() + .getWithResponse(resourceGroupName, peeringServiceName, prefixName, Context.NONE) + .getValue(); + return this; + } + + public PeeringServicePrefix refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPeeringServicePrefixes() + .getWithResponse(resourceGroupName, peeringServiceName, prefixName, context) + .getValue(); + return this; + } + + public PeeringServicePrefixImpl withPrefix(String prefix) { + this.innerModel().withPrefix(prefix); + return this; + } + + public PeeringServicePrefixImpl withPrefixValidationState(PrefixValidationState prefixValidationState) { + this.innerModel().withPrefixValidationState(prefixValidationState); + return this; + } + + public PeeringServicePrefixImpl withLearnedType(LearnedType learnedType) { + this.innerModel().withLearnedType(learnedType); + return this; + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServicePrefixesClientImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServicePrefixesClientImpl.java new file mode 100644 index 000000000000..f20e802151a9 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServicePrefixesClientImpl.java @@ -0,0 +1,635 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.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.PathParam; +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.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.fluent.PeeringServicePrefixesClient; +import com.azure.resourcemanager.peering.fluent.models.PeeringServicePrefixInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PeeringServicePrefixesClient. */ +public final class PeeringServicePrefixesClientImpl implements PeeringServicePrefixesClient { + private final ClientLogger logger = new ClientLogger(PeeringServicePrefixesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PeeringServicePrefixesService service; + + /** The service client containing this operation class. */ + private final PeeringManagementClientImpl client; + + /** + * Initializes an instance of PeeringServicePrefixesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PeeringServicePrefixesClientImpl(PeeringManagementClientImpl client) { + this.service = + RestProxy + .create(PeeringServicePrefixesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PeeringManagementClientPeeringServicePrefixes to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PeeringManagementCli") + private interface PeeringServicePrefixesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering" + + "/peeringServices/{peeringServiceName}/prefixes/{prefixName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("peeringServiceName") String peeringServiceName, + @PathParam("prefixName") String prefixName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering" + + "/peeringServices/{peeringServiceName}/prefixes/{prefixName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("peeringServiceName") String peeringServiceName, + @PathParam("prefixName") String prefixName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PeeringServicePrefixInner peeringServicePrefix, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering" + + "/peeringServices/{peeringServiceName}/prefixes/{prefixName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("peeringServiceName") String peeringServiceName, + @PathParam("prefixName") String prefixName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the peering service prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix 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 peering service prefix. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String peeringServiceName, String prefixName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (peeringServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null.")); + } + if (prefixName == null) { + return Mono.error(new IllegalArgumentException("Parameter prefixName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + peeringServiceName, + prefixName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the peering service prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix 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 peering service prefix. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String peeringServiceName, String prefixName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (peeringServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null.")); + } + if (prefixName == null) { + return Mono.error(new IllegalArgumentException("Parameter prefixName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + peeringServiceName, + prefixName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the peering service prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix 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 peering service prefix. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String peeringServiceName, String prefixName) { + return getWithResponseAsync(resourceGroupName, peeringServiceName, prefixName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the peering service prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix 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 peering service prefix. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PeeringServicePrefixInner get(String resourceGroupName, String peeringServiceName, String prefixName) { + return getAsync(resourceGroupName, peeringServiceName, prefixName).block(); + } + + /** + * Gets the peering service prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix 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 peering service prefix. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String peeringServiceName, String prefixName, Context context) { + return getWithResponseAsync(resourceGroupName, peeringServiceName, prefixName, context).block(); + } + + /** + * Creates or updates the peering prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix name. + * @param peeringServicePrefix The IP prefix for an peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 peering service prefix class. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String peeringServiceName, + String prefixName, + PeeringServicePrefixInner peeringServicePrefix) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (peeringServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null.")); + } + if (prefixName == null) { + return Mono.error(new IllegalArgumentException("Parameter prefixName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (peeringServicePrefix == null) { + return Mono + .error(new IllegalArgumentException("Parameter peeringServicePrefix is required and cannot be null.")); + } else { + peeringServicePrefix.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + peeringServiceName, + prefixName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + peeringServicePrefix, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the peering prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix name. + * @param peeringServicePrefix The IP prefix for an peering. + * @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 peering service prefix class. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String peeringServiceName, + String prefixName, + PeeringServicePrefixInner peeringServicePrefix, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (peeringServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null.")); + } + if (prefixName == null) { + return Mono.error(new IllegalArgumentException("Parameter prefixName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (peeringServicePrefix == null) { + return Mono + .error(new IllegalArgumentException("Parameter peeringServicePrefix is required and cannot be null.")); + } else { + peeringServicePrefix.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + peeringServiceName, + prefixName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + peeringServicePrefix, + accept, + context); + } + + /** + * Creates or updates the peering prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix name. + * @param peeringServicePrefix The IP prefix for an peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 peering service prefix class. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String peeringServiceName, + String prefixName, + PeeringServicePrefixInner peeringServicePrefix) { + return createOrUpdateWithResponseAsync(resourceGroupName, peeringServiceName, prefixName, peeringServicePrefix) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates the peering prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix name. + * @param peeringServicePrefix The IP prefix for an peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 peering service prefix class. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PeeringServicePrefixInner createOrUpdate( + String resourceGroupName, + String peeringServiceName, + String prefixName, + PeeringServicePrefixInner peeringServicePrefix) { + return createOrUpdateAsync(resourceGroupName, peeringServiceName, prefixName, peeringServicePrefix).block(); + } + + /** + * Creates or updates the peering prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix name. + * @param peeringServicePrefix The IP prefix for an peering. + * @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 peering service prefix class. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String peeringServiceName, + String prefixName, + PeeringServicePrefixInner peeringServicePrefix, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, peeringServiceName, prefixName, peeringServicePrefix, context) + .block(); + } + + /** + * removes the peering prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String peeringServiceName, String prefixName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (peeringServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null.")); + } + if (prefixName == null) { + return Mono.error(new IllegalArgumentException("Parameter prefixName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + peeringServiceName, + prefixName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * removes the peering prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String peeringServiceName, String prefixName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (peeringServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null.")); + } + if (prefixName == null) { + return Mono.error(new IllegalArgumentException("Parameter prefixName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + peeringServiceName, + prefixName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context); + } + + /** + * removes the peering prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String peeringServiceName, String prefixName) { + return deleteWithResponseAsync(resourceGroupName, peeringServiceName, prefixName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * removes the peering prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix 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 resourceGroupName, String peeringServiceName, String prefixName) { + deleteAsync(resourceGroupName, peeringServiceName, prefixName).block(); + } + + /** + * removes the peering prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String peeringServiceName, String prefixName, Context context) { + return deleteWithResponseAsync(resourceGroupName, peeringServiceName, prefixName, context).block(); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServicePrefixesImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServicePrefixesImpl.java new file mode 100644 index 000000000000..1d759b0acf33 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServicePrefixesImpl.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.implementation; + +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.peering.fluent.PeeringServicePrefixesClient; +import com.azure.resourcemanager.peering.fluent.models.PeeringServicePrefixInner; +import com.azure.resourcemanager.peering.models.PeeringServicePrefix; +import com.azure.resourcemanager.peering.models.PeeringServicePrefixes; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PeeringServicePrefixesImpl implements PeeringServicePrefixes { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringServicePrefixesImpl.class); + + private final PeeringServicePrefixesClient innerClient; + + private final com.azure.resourcemanager.peering.PeeringManager serviceManager; + + public PeeringServicePrefixesImpl( + PeeringServicePrefixesClient innerClient, com.azure.resourcemanager.peering.PeeringManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PeeringServicePrefix get(String resourceGroupName, String peeringServiceName, String prefixName) { + PeeringServicePrefixInner inner = this.serviceClient().get(resourceGroupName, peeringServiceName, prefixName); + if (inner != null) { + return new PeeringServicePrefixImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String peeringServiceName, String prefixName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, peeringServiceName, prefixName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PeeringServicePrefixImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String peeringServiceName, String prefixName) { + this.serviceClient().delete(resourceGroupName, peeringServiceName, prefixName); + } + + public Response deleteWithResponse( + String resourceGroupName, String peeringServiceName, String prefixName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, peeringServiceName, prefixName, context); + } + + public PeeringServicePrefix getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String peeringServiceName = Utils.getValueFromIdByName(id, "peeringServices"); + if (peeringServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'peeringServices'.", id))); + } + String prefixName = Utils.getValueFromIdByName(id, "prefixes"); + if (prefixName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'prefixes'.", id))); + } + return this.getWithResponse(resourceGroupName, peeringServiceName, prefixName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String peeringServiceName = Utils.getValueFromIdByName(id, "peeringServices"); + if (peeringServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'peeringServices'.", id))); + } + String prefixName = Utils.getValueFromIdByName(id, "prefixes"); + if (prefixName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'prefixes'.", id))); + } + return this.getWithResponse(resourceGroupName, peeringServiceName, prefixName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String peeringServiceName = Utils.getValueFromIdByName(id, "peeringServices"); + if (peeringServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'peeringServices'.", id))); + } + String prefixName = Utils.getValueFromIdByName(id, "prefixes"); + if (prefixName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'prefixes'.", id))); + } + this.deleteWithResponse(resourceGroupName, peeringServiceName, prefixName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String peeringServiceName = Utils.getValueFromIdByName(id, "peeringServices"); + if (peeringServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'peeringServices'.", id))); + } + String prefixName = Utils.getValueFromIdByName(id, "prefixes"); + if (prefixName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'prefixes'.", id))); + } + return this.deleteWithResponse(resourceGroupName, peeringServiceName, prefixName, context); + } + + private PeeringServicePrefixesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.peering.PeeringManager manager() { + return this.serviceManager; + } + + public PeeringServicePrefixImpl define(String name) { + return new PeeringServicePrefixImpl(name, this.manager()); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceProviderImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceProviderImpl.java new file mode 100644 index 000000000000..3aee4cc5491c --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceProviderImpl.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.peering.implementation; + +import com.azure.resourcemanager.peering.fluent.models.PeeringServiceProviderInner; +import com.azure.resourcemanager.peering.models.PeeringServiceProvider; + +public final class PeeringServiceProviderImpl implements PeeringServiceProvider { + private PeeringServiceProviderInner innerObject; + + private final com.azure.resourcemanager.peering.PeeringManager serviceManager; + + PeeringServiceProviderImpl( + PeeringServiceProviderInner innerObject, com.azure.resourcemanager.peering.PeeringManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String serviceProviderName() { + return this.innerModel().serviceProviderName(); + } + + public PeeringServiceProviderInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.peering.PeeringManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceProvidersClientImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceProvidersClientImpl.java new file mode 100644 index 000000000000..e10fbae881e4 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceProvidersClientImpl.java @@ -0,0 +1,295 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.fluent.PeeringServiceProvidersClient; +import com.azure.resourcemanager.peering.fluent.models.PeeringServiceProviderInner; +import com.azure.resourcemanager.peering.models.PeeringServiceProviderListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PeeringServiceProvidersClient. */ +public final class PeeringServiceProvidersClientImpl implements PeeringServiceProvidersClient { + private final ClientLogger logger = new ClientLogger(PeeringServiceProvidersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PeeringServiceProvidersService service; + + /** The service client containing this operation class. */ + private final PeeringManagementClientImpl client; + + /** + * Initializes an instance of PeeringServiceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PeeringServiceProvidersClientImpl(PeeringManagementClientImpl client) { + this.service = + RestProxy + .create(PeeringServiceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PeeringManagementClientPeeringServiceProviders to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PeeringManagementCli") + private interface PeeringServiceProvidersService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceProviders") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @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 all of the available peering service locations for the specified kind of peering. + * + * @throws 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 paginated list of peering service providers. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @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 paginated list of peering service providers. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @throws 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 paginated list of peering service providers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @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 paginated list of peering service providers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @throws 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 paginated list of peering service providers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @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 paginated list of peering service providers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peering service providers. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peering service providers. + */ + @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/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceProvidersImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceProvidersImpl.java new file mode 100644 index 000000000000..5badc1955881 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceProvidersImpl.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.peering.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.peering.fluent.PeeringServiceProvidersClient; +import com.azure.resourcemanager.peering.fluent.models.PeeringServiceProviderInner; +import com.azure.resourcemanager.peering.models.PeeringServiceProvider; +import com.azure.resourcemanager.peering.models.PeeringServiceProviders; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PeeringServiceProvidersImpl implements PeeringServiceProviders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringServiceProvidersImpl.class); + + private final PeeringServiceProvidersClient innerClient; + + private final com.azure.resourcemanager.peering.PeeringManager serviceManager; + + public PeeringServiceProvidersImpl( + PeeringServiceProvidersClient innerClient, com.azure.resourcemanager.peering.PeeringManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new PeeringServiceProviderImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new PeeringServiceProviderImpl(inner1, this.manager())); + } + + private PeeringServiceProvidersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.peering.PeeringManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServicesClientImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServicesClientImpl.java new file mode 100644 index 000000000000..2ccddfa76f19 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServicesClientImpl.java @@ -0,0 +1,1260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.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.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.fluent.PeeringServicesClient; +import com.azure.resourcemanager.peering.fluent.models.PeeringServiceInner; +import com.azure.resourcemanager.peering.models.PeeringServiceListResult; +import com.azure.resourcemanager.peering.models.ResourceTags; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PeeringServicesClient. */ +public final class PeeringServicesClientImpl implements PeeringServicesClient { + private final ClientLogger logger = new ClientLogger(PeeringServicesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PeeringServicesService service; + + /** The service client containing this operation class. */ + private final PeeringManagementClientImpl client; + + /** + * Initializes an instance of PeeringServicesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PeeringServicesClientImpl(PeeringManagementClientImpl client) { + this.service = + RestProxy.create(PeeringServicesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PeeringManagementClientPeeringServices to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PeeringManagementCli") + private interface PeeringServicesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering" + + "/peeringServices/{peeringServiceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("peeringServiceName") String peeringServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering" + + "/peeringServices/{peeringServiceName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("peeringServiceName") String peeringServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PeeringServiceInner peeringService, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering" + + "/peeringServices/{peeringServiceName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("peeringServiceName") String peeringServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering" + + "/peeringServices/{peeringServiceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("peeringServiceName") String peeringServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ResourceTags tags, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering" + + "/peeringServices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets an existing peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing peering service with the specified name under the given subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String peeringServiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (peeringServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + peeringServiceName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an existing peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing peering service with the specified name under the given subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String peeringServiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (peeringServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + peeringServiceName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets an existing peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing peering service with the specified name under the given subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String peeringServiceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, peeringServiceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an existing peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing peering service with the specified name under the given subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PeeringServiceInner getByResourceGroup(String resourceGroupName, String peeringServiceName) { + return getByResourceGroupAsync(resourceGroupName, peeringServiceName).block(); + } + + /** + * Gets an existing peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing peering service with the specified name under the given subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String peeringServiceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, peeringServiceName, context).block(); + } + + /** + * Creates a new peering service or updates an existing peering with the specified name under the given subscription + * and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param peeringService The properties needed to create or update a peering service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return peering Service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String peeringServiceName, PeeringServiceInner peeringService) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (peeringServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (peeringService == null) { + return Mono.error(new IllegalArgumentException("Parameter peeringService is required and cannot be null.")); + } else { + peeringService.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + peeringServiceName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + peeringService, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a new peering service or updates an existing peering with the specified name under the given subscription + * and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param peeringService The properties needed to create or update a peering service. + * @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 peering Service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String peeringServiceName, PeeringServiceInner peeringService, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (peeringServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (peeringService == null) { + return Mono.error(new IllegalArgumentException("Parameter peeringService is required and cannot be null.")); + } else { + peeringService.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + peeringServiceName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + peeringService, + accept, + context); + } + + /** + * Creates a new peering service or updates an existing peering with the specified name under the given subscription + * and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param peeringService The properties needed to create or update a peering service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return peering Service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String peeringServiceName, PeeringServiceInner peeringService) { + return createOrUpdateWithResponseAsync(resourceGroupName, peeringServiceName, peeringService) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates a new peering service or updates an existing peering with the specified name under the given subscription + * and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param peeringService The properties needed to create or update a peering service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return peering Service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PeeringServiceInner createOrUpdate( + String resourceGroupName, String peeringServiceName, PeeringServiceInner peeringService) { + return createOrUpdateAsync(resourceGroupName, peeringServiceName, peeringService).block(); + } + + /** + * Creates a new peering service or updates an existing peering with the specified name under the given subscription + * and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param peeringService The properties needed to create or update a peering service. + * @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 peering Service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String peeringServiceName, PeeringServiceInner peeringService, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, peeringServiceName, peeringService, context).block(); + } + + /** + * Deletes an existing peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String peeringServiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (peeringServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + peeringServiceName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String peeringServiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (peeringServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + peeringServiceName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes an existing peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String peeringServiceName) { + return deleteWithResponseAsync(resourceGroupName, peeringServiceName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes an existing peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String peeringServiceName) { + deleteAsync(resourceGroupName, peeringServiceName).block(); + } + + /** + * Deletes an existing peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String peeringServiceName, Context context) { + return deleteWithResponseAsync(resourceGroupName, peeringServiceName, context).block(); + } + + /** + * Updates tags for a peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param tags The resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return peering Service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String peeringServiceName, ResourceTags tags) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (peeringServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (tags == null) { + return Mono.error(new IllegalArgumentException("Parameter tags is required and cannot be null.")); + } else { + tags.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + peeringServiceName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + tags, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates tags for a peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param tags The resource tags. + * @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 peering Service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String peeringServiceName, ResourceTags tags, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (peeringServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (tags == null) { + return Mono.error(new IllegalArgumentException("Parameter tags is required and cannot be null.")); + } else { + tags.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + peeringServiceName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + tags, + accept, + context); + } + + /** + * Updates tags for a peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param tags The resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return peering Service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String peeringServiceName, ResourceTags tags) { + return updateWithResponseAsync(resourceGroupName, peeringServiceName, tags) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates tags for a peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param tags The resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return peering Service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PeeringServiceInner update(String resourceGroupName, String peeringServiceName, ResourceTags tags) { + return updateAsync(resourceGroupName, peeringServiceName, tags).block(); + } + + /** + * Updates tags for a peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param tags The resource tags. + * @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 peering Service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String peeringServiceName, ResourceTags tags, Context context) { + return updateWithResponseAsync(resourceGroupName, peeringServiceName, tags, context).block(); + } + + /** + * Lists all of the peering services under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 paginated list of peering services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the peering services under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 paginated list of peering services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the peering services under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 paginated list of peering services. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the peering services under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 paginated list of peering services. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the peering services under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 paginated list of peering services. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists all of the peering services under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 paginated list of peering services. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peering services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peering services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peering services. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peering services. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peering services. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peering services. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peering services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peering services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peering services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(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.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peering services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + 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 + .listBySubscriptionNext(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/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServicesImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServicesImpl.java new file mode 100644 index 000000000000..7c8483ece284 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServicesImpl.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.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.peering.fluent.PeeringServicesClient; +import com.azure.resourcemanager.peering.fluent.models.PeeringServiceInner; +import com.azure.resourcemanager.peering.models.PeeringService; +import com.azure.resourcemanager.peering.models.PeeringServices; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PeeringServicesImpl implements PeeringServices { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringServicesImpl.class); + + private final PeeringServicesClient innerClient; + + private final com.azure.resourcemanager.peering.PeeringManager serviceManager; + + public PeeringServicesImpl( + PeeringServicesClient innerClient, com.azure.resourcemanager.peering.PeeringManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PeeringService getByResourceGroup(String resourceGroupName, String peeringServiceName) { + PeeringServiceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, peeringServiceName); + if (inner != null) { + return new PeeringServiceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String peeringServiceName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, peeringServiceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PeeringServiceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String peeringServiceName) { + this.serviceClient().delete(resourceGroupName, peeringServiceName); + } + + public Response deleteWithResponse(String resourceGroupName, String peeringServiceName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, peeringServiceName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new PeeringServiceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new PeeringServiceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new PeeringServiceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new PeeringServiceImpl(inner1, this.manager())); + } + + public PeeringService getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String peeringServiceName = Utils.getValueFromIdByName(id, "peeringServices"); + if (peeringServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'peeringServices'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, peeringServiceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String peeringServiceName = Utils.getValueFromIdByName(id, "peeringServices"); + if (peeringServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'peeringServices'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, peeringServiceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String peeringServiceName = Utils.getValueFromIdByName(id, "peeringServices"); + if (peeringServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'peeringServices'.", id))); + } + this.deleteWithResponse(resourceGroupName, peeringServiceName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String peeringServiceName = Utils.getValueFromIdByName(id, "peeringServices"); + if (peeringServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'peeringServices'.", id))); + } + return this.deleteWithResponse(resourceGroupName, peeringServiceName, context); + } + + private PeeringServicesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.peering.PeeringManager manager() { + return this.serviceManager; + } + + public PeeringServiceImpl define(String name) { + return new PeeringServiceImpl(name, this.manager()); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringsClientImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringsClientImpl.java new file mode 100644 index 000000000000..66e1cf68edd6 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringsClientImpl.java @@ -0,0 +1,1243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.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.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.fluent.PeeringsClient; +import com.azure.resourcemanager.peering.fluent.models.PeeringInner; +import com.azure.resourcemanager.peering.models.PeeringListResult; +import com.azure.resourcemanager.peering.models.ResourceTags; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PeeringsClient. */ +public final class PeeringsClientImpl implements PeeringsClient { + private final ClientLogger logger = new ClientLogger(PeeringsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PeeringsService service; + + /** The service client containing this operation class. */ + private final PeeringManagementClientImpl client; + + /** + * Initializes an instance of PeeringsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PeeringsClientImpl(PeeringManagementClientImpl client) { + this.service = RestProxy.create(PeeringsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PeeringManagementClientPeerings to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PeeringManagementCli") + private interface PeeringsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings" + + "/{peeringName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("peeringName") String peeringName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings" + + "/{peeringName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("peeringName") String peeringName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PeeringInner peering, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings" + + "/{peeringName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("peeringName") String peeringName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings" + + "/{peeringName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("peeringName") String peeringName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ResourceTags tags, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets an existing peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing peering with the specified name under the given subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String peeringName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (peeringName == null) { + return Mono.error(new IllegalArgumentException("Parameter peeringName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + peeringName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an existing peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing peering with the specified name under the given subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String peeringName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (peeringName == null) { + return Mono.error(new IllegalArgumentException("Parameter peeringName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + peeringName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets an existing peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing peering with the specified name under the given subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String peeringName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, peeringName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an existing peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing peering with the specified name under the given subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PeeringInner getByResourceGroup(String resourceGroupName, String peeringName) { + return getByResourceGroupAsync(resourceGroupName, peeringName).block(); + } + + /** + * Gets an existing peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing peering with the specified name under the given subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String peeringName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, peeringName, context).block(); + } + + /** + * Creates a new peering or updates an existing peering with the specified name under the given subscription and + * resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param peering The properties needed to create or update a peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return peering is a logical representation of a set of connections to the Microsoft Cloud Edge at a location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String peeringName, PeeringInner peering) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (peeringName == null) { + return Mono.error(new IllegalArgumentException("Parameter peeringName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (peering == null) { + return Mono.error(new IllegalArgumentException("Parameter peering is required and cannot be null.")); + } else { + peering.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + peeringName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + peering, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a new peering or updates an existing peering with the specified name under the given subscription and + * resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param peering The properties needed to create or update a peering. + * @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 peering is a logical representation of a set of connections to the Microsoft Cloud Edge at a location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String peeringName, PeeringInner peering, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (peeringName == null) { + return Mono.error(new IllegalArgumentException("Parameter peeringName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (peering == null) { + return Mono.error(new IllegalArgumentException("Parameter peering is required and cannot be null.")); + } else { + peering.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + peeringName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + peering, + accept, + context); + } + + /** + * Creates a new peering or updates an existing peering with the specified name under the given subscription and + * resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param peering The properties needed to create or update a peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return peering is a logical representation of a set of connections to the Microsoft Cloud Edge at a location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String peeringName, PeeringInner peering) { + return createOrUpdateWithResponseAsync(resourceGroupName, peeringName, peering) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates a new peering or updates an existing peering with the specified name under the given subscription and + * resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param peering The properties needed to create or update a peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return peering is a logical representation of a set of connections to the Microsoft Cloud Edge at a location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PeeringInner createOrUpdate(String resourceGroupName, String peeringName, PeeringInner peering) { + return createOrUpdateAsync(resourceGroupName, peeringName, peering).block(); + } + + /** + * Creates a new peering or updates an existing peering with the specified name under the given subscription and + * resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param peering The properties needed to create or update a peering. + * @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 peering is a logical representation of a set of connections to the Microsoft Cloud Edge at a location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String peeringName, PeeringInner peering, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, peeringName, peering, context).block(); + } + + /** + * Deletes an existing peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String peeringName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (peeringName == null) { + return Mono.error(new IllegalArgumentException("Parameter peeringName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + peeringName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String peeringName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (peeringName == null) { + return Mono.error(new IllegalArgumentException("Parameter peeringName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + peeringName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes an existing peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String peeringName) { + return deleteWithResponseAsync(resourceGroupName, peeringName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes an existing peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String peeringName) { + deleteAsync(resourceGroupName, peeringName).block(); + } + + /** + * Deletes an existing peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String peeringName, Context context) { + return deleteWithResponseAsync(resourceGroupName, peeringName, context).block(); + } + + /** + * Updates tags for a peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param tags The resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return peering is a logical representation of a set of connections to the Microsoft Cloud Edge at a location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String peeringName, ResourceTags tags) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (peeringName == null) { + return Mono.error(new IllegalArgumentException("Parameter peeringName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (tags == null) { + return Mono.error(new IllegalArgumentException("Parameter tags is required and cannot be null.")); + } else { + tags.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + peeringName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + tags, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates tags for a peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param tags The resource tags. + * @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 peering is a logical representation of a set of connections to the Microsoft Cloud Edge at a location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String peeringName, ResourceTags tags, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (peeringName == null) { + return Mono.error(new IllegalArgumentException("Parameter peeringName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (tags == null) { + return Mono.error(new IllegalArgumentException("Parameter tags is required and cannot be null.")); + } else { + tags.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + peeringName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + tags, + accept, + context); + } + + /** + * Updates tags for a peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param tags The resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return peering is a logical representation of a set of connections to the Microsoft Cloud Edge at a location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String peeringName, ResourceTags tags) { + return updateWithResponseAsync(resourceGroupName, peeringName, tags) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates tags for a peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param tags The resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return peering is a logical representation of a set of connections to the Microsoft Cloud Edge at a location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PeeringInner update(String resourceGroupName, String peeringName, ResourceTags tags) { + return updateAsync(resourceGroupName, peeringName, tags).block(); + } + + /** + * Updates tags for a peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param tags The resource tags. + * @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 peering is a logical representation of a set of connections to the Microsoft Cloud Edge at a location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String peeringName, ResourceTags tags, Context context) { + return updateWithResponseAsync(resourceGroupName, peeringName, tags, context).block(); + } + + /** + * Lists all of the peerings under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the peerings under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the peerings under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the peerings under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the peerings under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists all of the peerings under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(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.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peerings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(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 + .listBySubscriptionNext(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/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringsImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringsImpl.java new file mode 100644 index 000000000000..0c21b4c6216c --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringsImpl.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.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.peering.fluent.PeeringsClient; +import com.azure.resourcemanager.peering.fluent.models.PeeringInner; +import com.azure.resourcemanager.peering.models.Peering; +import com.azure.resourcemanager.peering.models.Peerings; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PeeringsImpl implements Peerings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringsImpl.class); + + private final PeeringsClient innerClient; + + private final com.azure.resourcemanager.peering.PeeringManager serviceManager; + + public PeeringsImpl(PeeringsClient innerClient, com.azure.resourcemanager.peering.PeeringManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Peering getByResourceGroup(String resourceGroupName, String peeringName) { + PeeringInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, peeringName); + if (inner != null) { + return new PeeringImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String peeringName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, peeringName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PeeringImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String peeringName) { + this.serviceClient().delete(resourceGroupName, peeringName); + } + + public Response deleteWithResponse(String resourceGroupName, String peeringName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, peeringName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new PeeringImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new PeeringImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new PeeringImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new PeeringImpl(inner1, this.manager())); + } + + public Peering getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String peeringName = Utils.getValueFromIdByName(id, "peerings"); + if (peeringName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'peerings'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, peeringName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String peeringName = Utils.getValueFromIdByName(id, "peerings"); + if (peeringName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'peerings'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, peeringName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String peeringName = Utils.getValueFromIdByName(id, "peerings"); + if (peeringName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'peerings'.", id))); + } + this.deleteWithResponse(resourceGroupName, peeringName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String peeringName = Utils.getValueFromIdByName(id, "peerings"); + if (peeringName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'peerings'.", id))); + } + return this.deleteWithResponse(resourceGroupName, peeringName, context); + } + + private PeeringsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.peering.PeeringManager manager() { + return this.serviceManager; + } + + public PeeringImpl define(String name) { + return new PeeringImpl(name, this.manager()); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PrefixesClientImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PrefixesClientImpl.java new file mode 100644 index 000000000000..0b463b820f91 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PrefixesClientImpl.java @@ -0,0 +1,343 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.fluent.PrefixesClient; +import com.azure.resourcemanager.peering.fluent.models.PeeringServicePrefixInner; +import com.azure.resourcemanager.peering.models.PeeringServicePrefixListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrefixesClient. */ +public final class PrefixesClientImpl implements PrefixesClient { + private final ClientLogger logger = new ClientLogger(PrefixesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PrefixesService service; + + /** The service client containing this operation class. */ + private final PeeringManagementClientImpl client; + + /** + * Initializes an instance of PrefixesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrefixesClientImpl(PeeringManagementClientImpl client) { + this.service = RestProxy.create(PrefixesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PeeringManagementClientPrefixes to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PeeringManagementCli") + private interface PrefixesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering" + + "/peeringServices/{peeringServiceName}/prefixes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByPeeringService( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("peeringServiceName") String peeringServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByPeeringServiceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the peerings prefix in the resource group. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service 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 paginated list of [T]. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPeeringServiceSinglePageAsync( + String resourceGroupName, String peeringServiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (peeringServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByPeeringService( + this.client.getEndpoint(), + resourceGroupName, + peeringServiceName, + this.client.getSubscriptionId(), + 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 peerings prefix in the resource group. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service 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 paginated list of [T]. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPeeringServiceSinglePageAsync( + String resourceGroupName, String peeringServiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (peeringServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByPeeringService( + this.client.getEndpoint(), + resourceGroupName, + peeringServiceName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the peerings prefix in the resource group. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service 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 paginated list of [T]. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByPeeringServiceAsync( + String resourceGroupName, String peeringServiceName) { + return new PagedFlux<>( + () -> listByPeeringServiceSinglePageAsync(resourceGroupName, peeringServiceName), + nextLink -> listByPeeringServiceNextSinglePageAsync(nextLink)); + } + + /** + * Lists the peerings prefix in the resource group. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service 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 paginated list of [T]. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByPeeringServiceAsync( + String resourceGroupName, String peeringServiceName, Context context) { + return new PagedFlux<>( + () -> listByPeeringServiceSinglePageAsync(resourceGroupName, peeringServiceName, context), + nextLink -> listByPeeringServiceNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the peerings prefix in the resource group. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service 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 paginated list of [T]. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByPeeringService( + String resourceGroupName, String peeringServiceName) { + return new PagedIterable<>(listByPeeringServiceAsync(resourceGroupName, peeringServiceName)); + } + + /** + * Lists the peerings prefix in the resource group. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service 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 paginated list of [T]. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByPeeringService( + String resourceGroupName, String peeringServiceName, Context context) { + return new PagedIterable<>(listByPeeringServiceAsync(resourceGroupName, peeringServiceName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of [T]. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPeeringServiceNextSinglePageAsync(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.listByPeeringServiceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of [T]. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPeeringServiceNextSinglePageAsync( + 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 + .listByPeeringServiceNext(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/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PrefixesImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PrefixesImpl.java new file mode 100644 index 000000000000..e357579b4533 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PrefixesImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.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.peering.fluent.PrefixesClient; +import com.azure.resourcemanager.peering.fluent.models.PeeringServicePrefixInner; +import com.azure.resourcemanager.peering.models.PeeringServicePrefix; +import com.azure.resourcemanager.peering.models.Prefixes; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PrefixesImpl implements Prefixes { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrefixesImpl.class); + + private final PrefixesClient innerClient; + + private final com.azure.resourcemanager.peering.PeeringManager serviceManager; + + public PrefixesImpl(PrefixesClient innerClient, com.azure.resourcemanager.peering.PeeringManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByPeeringService( + String resourceGroupName, String peeringServiceName) { + PagedIterable inner = + this.serviceClient().listByPeeringService(resourceGroupName, peeringServiceName); + return Utils.mapPage(inner, inner1 -> new PeeringServicePrefixImpl(inner1, this.manager())); + } + + public PagedIterable listByPeeringService( + String resourceGroupName, String peeringServiceName, Context context) { + PagedIterable inner = + this.serviceClient().listByPeeringService(resourceGroupName, peeringServiceName, context); + return Utils.mapPage(inner, inner1 -> new PeeringServicePrefixImpl(inner1, this.manager())); + } + + private PrefixesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.peering.PeeringManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/ResourceProvidersClientImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 000000000000..56a06f36a347 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +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.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.peering.models.CheckServiceProviderAvailabilityInput; +import com.azure.resourcemanager.peering.models.Enum0; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public final class ResourceProvidersClientImpl implements ResourceProvidersClient { + private final ClientLogger logger = new ClientLogger(ResourceProvidersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ResourceProvidersService service; + + /** The service client containing this operation class. */ + private final PeeringManagementClientImpl client; + + /** + * Initializes an instance of ResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProvidersClientImpl(PeeringManagementClientImpl client) { + this.service = + RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PeeringManagementClientResourceProviders to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PeeringManagementCli") + private interface ResourceProvidersService { + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Peering/CheckServiceProviderAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkServiceProviderAvailability( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Checks if the peering service provider is present within 1000 miles of customer's location. + * + * @param checkServiceProviderAvailabilityInput The CheckServiceProviderAvailabilityInput indicating customer + * location and service provider. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkServiceProviderAvailabilityWithResponseAsync( + CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (checkServiceProviderAvailabilityInput == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter checkServiceProviderAvailabilityInput is required and cannot be null.")); + } else { + checkServiceProviderAvailabilityInput.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkServiceProviderAvailability( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + checkServiceProviderAvailabilityInput, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks if the peering service provider is present within 1000 miles of customer's location. + * + * @param checkServiceProviderAvailabilityInput The CheckServiceProviderAvailabilityInput indicating customer + * location and service provider. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkServiceProviderAvailabilityWithResponseAsync( + CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (checkServiceProviderAvailabilityInput == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter checkServiceProviderAvailabilityInput is required and cannot be null.")); + } else { + checkServiceProviderAvailabilityInput.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkServiceProviderAvailability( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + checkServiceProviderAvailabilityInput, + accept, + context); + } + + /** + * Checks if the peering service provider is present within 1000 miles of customer's location. + * + * @param checkServiceProviderAvailabilityInput The CheckServiceProviderAvailabilityInput indicating customer + * location and service provider. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkServiceProviderAvailabilityAsync( + CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput) { + return checkServiceProviderAvailabilityWithResponseAsync(checkServiceProviderAvailabilityInput) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Checks if the peering service provider is present within 1000 miles of customer's location. + * + * @param checkServiceProviderAvailabilityInput The CheckServiceProviderAvailabilityInput indicating customer + * location and service provider. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Enum0 checkServiceProviderAvailability( + CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput) { + return checkServiceProviderAvailabilityAsync(checkServiceProviderAvailabilityInput).block(); + } + + /** + * Checks if the peering service provider is present within 1000 miles of customer's location. + * + * @param checkServiceProviderAvailabilityInput The CheckServiceProviderAvailabilityInput indicating customer + * location and service provider. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkServiceProviderAvailabilityWithResponse( + CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput, Context context) { + return checkServiceProviderAvailabilityWithResponseAsync(checkServiceProviderAvailabilityInput, context) + .block(); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/ResourceProvidersImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/ResourceProvidersImpl.java new file mode 100644 index 000000000000..29d6b9272cc7 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/ResourceProvidersImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.peering.models.CheckServiceProviderAvailabilityInput; +import com.azure.resourcemanager.peering.models.Enum0; +import com.azure.resourcemanager.peering.models.ResourceProviders; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ResourceProvidersImpl implements ResourceProviders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProvidersImpl.class); + + private final ResourceProvidersClient innerClient; + + private final com.azure.resourcemanager.peering.PeeringManager serviceManager; + + public ResourceProvidersImpl( + ResourceProvidersClient innerClient, com.azure.resourcemanager.peering.PeeringManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Enum0 checkServiceProviderAvailability( + CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput) { + return this.serviceClient().checkServiceProviderAvailability(checkServiceProviderAvailabilityInput); + } + + public Response checkServiceProviderAvailabilityWithResponse( + CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput, Context context) { + return this + .serviceClient() + .checkServiceProviderAvailabilityWithResponse(checkServiceProviderAvailabilityInput, context); + } + + private ResourceProvidersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.peering.PeeringManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/Utils.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/Utils.java new file mode 100644 index 000000000000..2f205ae6f821 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/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.peering.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/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/package-info.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/package-info.java new file mode 100644 index 000000000000..29dd4974398e --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/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 PeeringManagementClient. Peering Client. */ +package com.azure.resourcemanager.peering.implementation; diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/BgpSession.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/BgpSession.java new file mode 100644 index 000000000000..ef87a7e4ba72 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/BgpSession.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties that define a BGP session. */ +@Fluent +public final class BgpSession { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BgpSession.class); + + /* + * The IPv4 prefix that contains both ends' IPv4 addresses. + */ + @JsonProperty(value = "sessionPrefixV4") + private String sessionPrefixV4; + + /* + * The IPv6 prefix that contains both ends' IPv6 addresses. + */ + @JsonProperty(value = "sessionPrefixV6") + private String sessionPrefixV6; + + /* + * The IPv4 session address on Microsoft's end. + */ + @JsonProperty(value = "microsoftSessionIPv4Address", access = JsonProperty.Access.WRITE_ONLY) + private String microsoftSessionIPv4Address; + + /* + * The IPv6 session address on Microsoft's end. + */ + @JsonProperty(value = "microsoftSessionIPv6Address", access = JsonProperty.Access.WRITE_ONLY) + private String microsoftSessionIPv6Address; + + /* + * The IPv4 session address on peer's end. + */ + @JsonProperty(value = "peerSessionIPv4Address") + private String peerSessionIPv4Address; + + /* + * The IPv6 session address on peer's end. + */ + @JsonProperty(value = "peerSessionIPv6Address") + private String peerSessionIPv6Address; + + /* + * The state of the IPv4 session. + */ + @JsonProperty(value = "sessionStateV4", access = JsonProperty.Access.WRITE_ONLY) + private SessionStateV4 sessionStateV4; + + /* + * The state of the IPv6 session. + */ + @JsonProperty(value = "sessionStateV6", access = JsonProperty.Access.WRITE_ONLY) + private SessionStateV6 sessionStateV6; + + /* + * The maximum number of prefixes advertised over the IPv4 session. + */ + @JsonProperty(value = "maxPrefixesAdvertisedV4") + private Integer maxPrefixesAdvertisedV4; + + /* + * The maximum number of prefixes advertised over the IPv6 session. + */ + @JsonProperty(value = "maxPrefixesAdvertisedV6") + private Integer maxPrefixesAdvertisedV6; + + /* + * The MD5 authentication key of the session. + */ + @JsonProperty(value = "md5AuthenticationKey") + private String md5AuthenticationKey; + + /** + * Get the sessionPrefixV4 property: The IPv4 prefix that contains both ends' IPv4 addresses. + * + * @return the sessionPrefixV4 value. + */ + public String sessionPrefixV4() { + return this.sessionPrefixV4; + } + + /** + * Set the sessionPrefixV4 property: The IPv4 prefix that contains both ends' IPv4 addresses. + * + * @param sessionPrefixV4 the sessionPrefixV4 value to set. + * @return the BgpSession object itself. + */ + public BgpSession withSessionPrefixV4(String sessionPrefixV4) { + this.sessionPrefixV4 = sessionPrefixV4; + return this; + } + + /** + * Get the sessionPrefixV6 property: The IPv6 prefix that contains both ends' IPv6 addresses. + * + * @return the sessionPrefixV6 value. + */ + public String sessionPrefixV6() { + return this.sessionPrefixV6; + } + + /** + * Set the sessionPrefixV6 property: The IPv6 prefix that contains both ends' IPv6 addresses. + * + * @param sessionPrefixV6 the sessionPrefixV6 value to set. + * @return the BgpSession object itself. + */ + public BgpSession withSessionPrefixV6(String sessionPrefixV6) { + this.sessionPrefixV6 = sessionPrefixV6; + return this; + } + + /** + * Get the microsoftSessionIPv4Address property: The IPv4 session address on Microsoft's end. + * + * @return the microsoftSessionIPv4Address value. + */ + public String microsoftSessionIPv4Address() { + return this.microsoftSessionIPv4Address; + } + + /** + * Get the microsoftSessionIPv6Address property: The IPv6 session address on Microsoft's end. + * + * @return the microsoftSessionIPv6Address value. + */ + public String microsoftSessionIPv6Address() { + return this.microsoftSessionIPv6Address; + } + + /** + * Get the peerSessionIPv4Address property: The IPv4 session address on peer's end. + * + * @return the peerSessionIPv4Address value. + */ + public String peerSessionIPv4Address() { + return this.peerSessionIPv4Address; + } + + /** + * Set the peerSessionIPv4Address property: The IPv4 session address on peer's end. + * + * @param peerSessionIPv4Address the peerSessionIPv4Address value to set. + * @return the BgpSession object itself. + */ + public BgpSession withPeerSessionIPv4Address(String peerSessionIPv4Address) { + this.peerSessionIPv4Address = peerSessionIPv4Address; + return this; + } + + /** + * Get the peerSessionIPv6Address property: The IPv6 session address on peer's end. + * + * @return the peerSessionIPv6Address value. + */ + public String peerSessionIPv6Address() { + return this.peerSessionIPv6Address; + } + + /** + * Set the peerSessionIPv6Address property: The IPv6 session address on peer's end. + * + * @param peerSessionIPv6Address the peerSessionIPv6Address value to set. + * @return the BgpSession object itself. + */ + public BgpSession withPeerSessionIPv6Address(String peerSessionIPv6Address) { + this.peerSessionIPv6Address = peerSessionIPv6Address; + return this; + } + + /** + * Get the sessionStateV4 property: The state of the IPv4 session. + * + * @return the sessionStateV4 value. + */ + public SessionStateV4 sessionStateV4() { + return this.sessionStateV4; + } + + /** + * Get the sessionStateV6 property: The state of the IPv6 session. + * + * @return the sessionStateV6 value. + */ + public SessionStateV6 sessionStateV6() { + return this.sessionStateV6; + } + + /** + * Get the maxPrefixesAdvertisedV4 property: The maximum number of prefixes advertised over the IPv4 session. + * + * @return the maxPrefixesAdvertisedV4 value. + */ + public Integer maxPrefixesAdvertisedV4() { + return this.maxPrefixesAdvertisedV4; + } + + /** + * Set the maxPrefixesAdvertisedV4 property: The maximum number of prefixes advertised over the IPv4 session. + * + * @param maxPrefixesAdvertisedV4 the maxPrefixesAdvertisedV4 value to set. + * @return the BgpSession object itself. + */ + public BgpSession withMaxPrefixesAdvertisedV4(Integer maxPrefixesAdvertisedV4) { + this.maxPrefixesAdvertisedV4 = maxPrefixesAdvertisedV4; + return this; + } + + /** + * Get the maxPrefixesAdvertisedV6 property: The maximum number of prefixes advertised over the IPv6 session. + * + * @return the maxPrefixesAdvertisedV6 value. + */ + public Integer maxPrefixesAdvertisedV6() { + return this.maxPrefixesAdvertisedV6; + } + + /** + * Set the maxPrefixesAdvertisedV6 property: The maximum number of prefixes advertised over the IPv6 session. + * + * @param maxPrefixesAdvertisedV6 the maxPrefixesAdvertisedV6 value to set. + * @return the BgpSession object itself. + */ + public BgpSession withMaxPrefixesAdvertisedV6(Integer maxPrefixesAdvertisedV6) { + this.maxPrefixesAdvertisedV6 = maxPrefixesAdvertisedV6; + return this; + } + + /** + * Get the md5AuthenticationKey property: The MD5 authentication key of the session. + * + * @return the md5AuthenticationKey value. + */ + public String md5AuthenticationKey() { + return this.md5AuthenticationKey; + } + + /** + * Set the md5AuthenticationKey property: The MD5 authentication key of the session. + * + * @param md5AuthenticationKey the md5AuthenticationKey value to set. + * @return the BgpSession object itself. + */ + public BgpSession withMd5AuthenticationKey(String md5AuthenticationKey) { + this.md5AuthenticationKey = md5AuthenticationKey; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/CheckServiceProviderAvailabilityInput.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/CheckServiceProviderAvailabilityInput.java new file mode 100644 index 000000000000..628d7f627cee --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/CheckServiceProviderAvailabilityInput.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.peering.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Class for CheckServiceProviderAvailabilityInput. */ +@Fluent +public final class CheckServiceProviderAvailabilityInput { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckServiceProviderAvailabilityInput.class); + + /* + * Gets or sets the PeeringServiceLocation + */ + @JsonProperty(value = "peeringServiceLocation") + private String peeringServiceLocation; + + /* + * Gets or sets the PeeringServiceProvider + */ + @JsonProperty(value = "peeringServiceProvider") + private String peeringServiceProvider; + + /** + * Get the peeringServiceLocation property: Gets or sets the PeeringServiceLocation. + * + * @return the peeringServiceLocation value. + */ + public String peeringServiceLocation() { + return this.peeringServiceLocation; + } + + /** + * Set the peeringServiceLocation property: Gets or sets the PeeringServiceLocation. + * + * @param peeringServiceLocation the peeringServiceLocation value to set. + * @return the CheckServiceProviderAvailabilityInput object itself. + */ + public CheckServiceProviderAvailabilityInput withPeeringServiceLocation(String peeringServiceLocation) { + this.peeringServiceLocation = peeringServiceLocation; + return this; + } + + /** + * Get the peeringServiceProvider property: Gets or sets the PeeringServiceProvider. + * + * @return the peeringServiceProvider value. + */ + public String peeringServiceProvider() { + return this.peeringServiceProvider; + } + + /** + * Set the peeringServiceProvider property: Gets or sets the PeeringServiceProvider. + * + * @param peeringServiceProvider the peeringServiceProvider value to set. + * @return the CheckServiceProviderAvailabilityInput object itself. + */ + public CheckServiceProviderAvailabilityInput withPeeringServiceProvider(String peeringServiceProvider) { + this.peeringServiceProvider = peeringServiceProvider; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ConnectionState.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ConnectionState.java new file mode 100644 index 000000000000..d17a09f1a698 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ConnectionState.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.peering.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ConnectionState. */ +public final class ConnectionState extends ExpandableStringEnum { + /** Static value None for ConnectionState. */ + public static final ConnectionState NONE = fromString("None"); + + /** Static value PendingApproval for ConnectionState. */ + public static final ConnectionState PENDING_APPROVAL = fromString("PendingApproval"); + + /** Static value Approved for ConnectionState. */ + public static final ConnectionState APPROVED = fromString("Approved"); + + /** Static value ProvisioningStarted for ConnectionState. */ + public static final ConnectionState PROVISIONING_STARTED = fromString("ProvisioningStarted"); + + /** Static value ProvisioningFailed for ConnectionState. */ + public static final ConnectionState PROVISIONING_FAILED = fromString("ProvisioningFailed"); + + /** Static value ProvisioningCompleted for ConnectionState. */ + public static final ConnectionState PROVISIONING_COMPLETED = fromString("ProvisioningCompleted"); + + /** Static value Validating for ConnectionState. */ + public static final ConnectionState VALIDATING = fromString("Validating"); + + /** Static value Active for ConnectionState. */ + public static final ConnectionState ACTIVE = fromString("Active"); + + /** + * Creates or finds a ConnectionState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConnectionState. + */ + @JsonCreator + public static ConnectionState fromString(String name) { + return fromString(name, ConnectionState.class); + } + + /** @return known ConnectionState values. */ + public static Collection values() { + return values(ConnectionState.class); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ContactInfo.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ContactInfo.java new file mode 100644 index 000000000000..e502636fa5d4 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ContactInfo.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The contact information of the peer. */ +@Fluent +public final class ContactInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContactInfo.class); + + /* + * The list of email addresses. + */ + @JsonProperty(value = "emails") + private List emails; + + /* + * The list of contact numbers. + */ + @JsonProperty(value = "phone") + private List phone; + + /** + * Get the emails property: The list of email addresses. + * + * @return the emails value. + */ + public List emails() { + return this.emails; + } + + /** + * Set the emails property: The list of email addresses. + * + * @param emails the emails value to set. + * @return the ContactInfo object itself. + */ + public ContactInfo withEmails(List emails) { + this.emails = emails; + return this; + } + + /** + * Get the phone property: The list of contact numbers. + * + * @return the phone value. + */ + public List phone() { + return this.phone; + } + + /** + * Set the phone property: The list of contact numbers. + * + * @param phone the phone value to set. + * @return the ContactInfo object itself. + */ + public ContactInfo withPhone(List phone) { + this.phone = phone; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/DirectConnection.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/DirectConnection.java new file mode 100644 index 000000000000..e59d31c3cd95 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/DirectConnection.java @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties that define a direct connection. */ +@Fluent +public final class DirectConnection { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DirectConnection.class); + + /* + * The bandwidth of the connection. + */ + @JsonProperty(value = "bandwidthInMbps") + private Integer bandwidthInMbps; + + /* + * The bandwidth that is actually provisioned. + */ + @JsonProperty(value = "provisionedBandwidthInMbps") + private Integer provisionedBandwidthInMbps; + + /* + * The field indicating if Microsoft provides session ip addresses. + */ + @JsonProperty(value = "sessionAddressProvider") + private SessionAddressProvider sessionAddressProvider; + + /* + * The flag that indicates whether or not the connection is used for + * peering service. + */ + @JsonProperty(value = "useForPeeringService") + private Boolean useForPeeringService; + + /* + * The PeeringDB.com ID of the facility at which the connection has to be + * set up. + */ + @JsonProperty(value = "peeringDBFacilityId") + private Integer peeringDBFacilityId; + + /* + * The state of the connection. + */ + @JsonProperty(value = "connectionState", access = JsonProperty.Access.WRITE_ONLY) + private ConnectionState connectionState; + + /* + * The BGP session associated with the connection. + */ + @JsonProperty(value = "bgpSession") + private BgpSession bgpSession; + + /* + * The unique identifier (GUID) for the connection. + */ + @JsonProperty(value = "connectionIdentifier") + private String connectionIdentifier; + + /** + * Get the bandwidthInMbps property: The bandwidth of the connection. + * + * @return the bandwidthInMbps value. + */ + public Integer bandwidthInMbps() { + return this.bandwidthInMbps; + } + + /** + * Set the bandwidthInMbps property: The bandwidth of the connection. + * + * @param bandwidthInMbps the bandwidthInMbps value to set. + * @return the DirectConnection object itself. + */ + public DirectConnection withBandwidthInMbps(Integer bandwidthInMbps) { + this.bandwidthInMbps = bandwidthInMbps; + return this; + } + + /** + * Get the provisionedBandwidthInMbps property: The bandwidth that is actually provisioned. + * + * @return the provisionedBandwidthInMbps value. + */ + public Integer provisionedBandwidthInMbps() { + return this.provisionedBandwidthInMbps; + } + + /** + * Set the provisionedBandwidthInMbps property: The bandwidth that is actually provisioned. + * + * @param provisionedBandwidthInMbps the provisionedBandwidthInMbps value to set. + * @return the DirectConnection object itself. + */ + public DirectConnection withProvisionedBandwidthInMbps(Integer provisionedBandwidthInMbps) { + this.provisionedBandwidthInMbps = provisionedBandwidthInMbps; + return this; + } + + /** + * Get the sessionAddressProvider property: The field indicating if Microsoft provides session ip addresses. + * + * @return the sessionAddressProvider value. + */ + public SessionAddressProvider sessionAddressProvider() { + return this.sessionAddressProvider; + } + + /** + * Set the sessionAddressProvider property: The field indicating if Microsoft provides session ip addresses. + * + * @param sessionAddressProvider the sessionAddressProvider value to set. + * @return the DirectConnection object itself. + */ + public DirectConnection withSessionAddressProvider(SessionAddressProvider sessionAddressProvider) { + this.sessionAddressProvider = sessionAddressProvider; + return this; + } + + /** + * Get the useForPeeringService property: The flag that indicates whether or not the connection is used for peering + * service. + * + * @return the useForPeeringService value. + */ + public Boolean useForPeeringService() { + return this.useForPeeringService; + } + + /** + * Set the useForPeeringService property: The flag that indicates whether or not the connection is used for peering + * service. + * + * @param useForPeeringService the useForPeeringService value to set. + * @return the DirectConnection object itself. + */ + public DirectConnection withUseForPeeringService(Boolean useForPeeringService) { + this.useForPeeringService = useForPeeringService; + return this; + } + + /** + * Get the peeringDBFacilityId property: The PeeringDB.com ID of the facility at which the connection has to be set + * up. + * + * @return the peeringDBFacilityId value. + */ + public Integer peeringDBFacilityId() { + return this.peeringDBFacilityId; + } + + /** + * Set the peeringDBFacilityId property: The PeeringDB.com ID of the facility at which the connection has to be set + * up. + * + * @param peeringDBFacilityId the peeringDBFacilityId value to set. + * @return the DirectConnection object itself. + */ + public DirectConnection withPeeringDBFacilityId(Integer peeringDBFacilityId) { + this.peeringDBFacilityId = peeringDBFacilityId; + return this; + } + + /** + * Get the connectionState property: The state of the connection. + * + * @return the connectionState value. + */ + public ConnectionState connectionState() { + return this.connectionState; + } + + /** + * Get the bgpSession property: The BGP session associated with the connection. + * + * @return the bgpSession value. + */ + public BgpSession bgpSession() { + return this.bgpSession; + } + + /** + * Set the bgpSession property: The BGP session associated with the connection. + * + * @param bgpSession the bgpSession value to set. + * @return the DirectConnection object itself. + */ + public DirectConnection withBgpSession(BgpSession bgpSession) { + this.bgpSession = bgpSession; + return this; + } + + /** + * Get the connectionIdentifier property: The unique identifier (GUID) for the connection. + * + * @return the connectionIdentifier value. + */ + public String connectionIdentifier() { + return this.connectionIdentifier; + } + + /** + * Set the connectionIdentifier property: The unique identifier (GUID) for the connection. + * + * @param connectionIdentifier the connectionIdentifier value to set. + * @return the DirectConnection object itself. + */ + public DirectConnection withConnectionIdentifier(String connectionIdentifier) { + this.connectionIdentifier = connectionIdentifier; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (bgpSession() != null) { + bgpSession().validate(); + } + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/DirectPeeringFacility.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/DirectPeeringFacility.java new file mode 100644 index 000000000000..b396d6ea1f62 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/DirectPeeringFacility.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.peering.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties that define a direct peering facility. */ +@Fluent +public final class DirectPeeringFacility { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DirectPeeringFacility.class); + + /* + * The address of the direct peering facility. + */ + @JsonProperty(value = "address") + private String address; + + /* + * The type of the direct peering. + */ + @JsonProperty(value = "directPeeringType") + private DirectPeeringType directPeeringType; + + /* + * The PeeringDB.com ID of the facility. + */ + @JsonProperty(value = "peeringDBFacilityId") + private Integer peeringDBFacilityId; + + /* + * The PeeringDB.com URL of the facility. + */ + @JsonProperty(value = "peeringDBFacilityLink") + private String peeringDBFacilityLink; + + /** + * Get the address property: The address of the direct peering facility. + * + * @return the address value. + */ + public String address() { + return this.address; + } + + /** + * Set the address property: The address of the direct peering facility. + * + * @param address the address value to set. + * @return the DirectPeeringFacility object itself. + */ + public DirectPeeringFacility withAddress(String address) { + this.address = address; + return this; + } + + /** + * Get the directPeeringType property: The type of the direct peering. + * + * @return the directPeeringType value. + */ + public DirectPeeringType directPeeringType() { + return this.directPeeringType; + } + + /** + * Set the directPeeringType property: The type of the direct peering. + * + * @param directPeeringType the directPeeringType value to set. + * @return the DirectPeeringFacility object itself. + */ + public DirectPeeringFacility withDirectPeeringType(DirectPeeringType directPeeringType) { + this.directPeeringType = directPeeringType; + return this; + } + + /** + * Get the peeringDBFacilityId property: The PeeringDB.com ID of the facility. + * + * @return the peeringDBFacilityId value. + */ + public Integer peeringDBFacilityId() { + return this.peeringDBFacilityId; + } + + /** + * Set the peeringDBFacilityId property: The PeeringDB.com ID of the facility. + * + * @param peeringDBFacilityId the peeringDBFacilityId value to set. + * @return the DirectPeeringFacility object itself. + */ + public DirectPeeringFacility withPeeringDBFacilityId(Integer peeringDBFacilityId) { + this.peeringDBFacilityId = peeringDBFacilityId; + return this; + } + + /** + * Get the peeringDBFacilityLink property: The PeeringDB.com URL of the facility. + * + * @return the peeringDBFacilityLink value. + */ + public String peeringDBFacilityLink() { + return this.peeringDBFacilityLink; + } + + /** + * Set the peeringDBFacilityLink property: The PeeringDB.com URL of the facility. + * + * @param peeringDBFacilityLink the peeringDBFacilityLink value to set. + * @return the DirectPeeringFacility object itself. + */ + public DirectPeeringFacility withPeeringDBFacilityLink(String peeringDBFacilityLink) { + this.peeringDBFacilityLink = peeringDBFacilityLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/DirectPeeringType.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/DirectPeeringType.java new file mode 100644 index 000000000000..1dd6de3011f4 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/DirectPeeringType.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DirectPeeringType. */ +public final class DirectPeeringType extends ExpandableStringEnum { + /** Static value Edge for DirectPeeringType. */ + public static final DirectPeeringType EDGE = fromString("Edge"); + + /** Static value Transit for DirectPeeringType. */ + public static final DirectPeeringType TRANSIT = fromString("Transit"); + + /** Static value Cdn for DirectPeeringType. */ + public static final DirectPeeringType CDN = fromString("Cdn"); + + /** Static value Internal for DirectPeeringType. */ + public static final DirectPeeringType INTERNAL = fromString("Internal"); + + /** + * Creates or finds a DirectPeeringType from its string representation. + * + * @param name a name to look for. + * @return the corresponding DirectPeeringType. + */ + @JsonCreator + public static DirectPeeringType fromString(String name) { + return fromString(name, DirectPeeringType.class); + } + + /** @return known DirectPeeringType values. */ + public static Collection values() { + return values(DirectPeeringType.class); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Enum0.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Enum0.java new file mode 100644 index 000000000000..a9267b378527 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Enum0.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.peering.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Enum0. */ +public final class Enum0 extends ExpandableStringEnum { + /** Static value Available for Enum0. */ + public static final Enum0 AVAILABLE = fromString("Available"); + + /** Static value UnAvailable for Enum0. */ + public static final Enum0 UN_AVAILABLE = fromString("UnAvailable"); + + /** + * Creates or finds a Enum0 from its string representation. + * + * @param name a name to look for. + * @return the corresponding Enum0. + */ + @JsonCreator + public static Enum0 fromString(String name) { + return fromString(name, Enum0.class); + } + + /** @return known Enum0 values. */ + public static Collection values() { + return values(Enum0.class); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ExchangeConnection.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ExchangeConnection.java new file mode 100644 index 000000000000..d6a7e767fcfd --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ExchangeConnection.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.peering.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties that define an exchange connection. */ +@Fluent +public final class ExchangeConnection { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExchangeConnection.class); + + /* + * The PeeringDB.com ID of the facility at which the connection has to be + * set up. + */ + @JsonProperty(value = "peeringDBFacilityId") + private Integer peeringDBFacilityId; + + /* + * The state of the connection. + */ + @JsonProperty(value = "connectionState", access = JsonProperty.Access.WRITE_ONLY) + private ConnectionState connectionState; + + /* + * The BGP session associated with the connection. + */ + @JsonProperty(value = "bgpSession") + private BgpSession bgpSession; + + /* + * The unique identifier (GUID) for the connection. + */ + @JsonProperty(value = "connectionIdentifier") + private String connectionIdentifier; + + /** + * Get the peeringDBFacilityId property: The PeeringDB.com ID of the facility at which the connection has to be set + * up. + * + * @return the peeringDBFacilityId value. + */ + public Integer peeringDBFacilityId() { + return this.peeringDBFacilityId; + } + + /** + * Set the peeringDBFacilityId property: The PeeringDB.com ID of the facility at which the connection has to be set + * up. + * + * @param peeringDBFacilityId the peeringDBFacilityId value to set. + * @return the ExchangeConnection object itself. + */ + public ExchangeConnection withPeeringDBFacilityId(Integer peeringDBFacilityId) { + this.peeringDBFacilityId = peeringDBFacilityId; + return this; + } + + /** + * Get the connectionState property: The state of the connection. + * + * @return the connectionState value. + */ + public ConnectionState connectionState() { + return this.connectionState; + } + + /** + * Get the bgpSession property: The BGP session associated with the connection. + * + * @return the bgpSession value. + */ + public BgpSession bgpSession() { + return this.bgpSession; + } + + /** + * Set the bgpSession property: The BGP session associated with the connection. + * + * @param bgpSession the bgpSession value to set. + * @return the ExchangeConnection object itself. + */ + public ExchangeConnection withBgpSession(BgpSession bgpSession) { + this.bgpSession = bgpSession; + return this; + } + + /** + * Get the connectionIdentifier property: The unique identifier (GUID) for the connection. + * + * @return the connectionIdentifier value. + */ + public String connectionIdentifier() { + return this.connectionIdentifier; + } + + /** + * Set the connectionIdentifier property: The unique identifier (GUID) for the connection. + * + * @param connectionIdentifier the connectionIdentifier value to set. + * @return the ExchangeConnection object itself. + */ + public ExchangeConnection withConnectionIdentifier(String connectionIdentifier) { + this.connectionIdentifier = connectionIdentifier; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (bgpSession() != null) { + bgpSession().validate(); + } + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ExchangePeeringFacility.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ExchangePeeringFacility.java new file mode 100644 index 000000000000..b90bd8db9877 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ExchangePeeringFacility.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties that define an exchange peering facility. */ +@Fluent +public final class ExchangePeeringFacility { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExchangePeeringFacility.class); + + /* + * The name of the exchange peering facility. + */ + @JsonProperty(value = "exchangeName") + private String exchangeName; + + /* + * The bandwidth of the connection between Microsoft and the exchange + * peering facility. + */ + @JsonProperty(value = "bandwidthInMbps") + private Integer bandwidthInMbps; + + /* + * The IPv4 address of Microsoft at the exchange peering facility. + */ + @JsonProperty(value = "microsoftIPv4Address") + private String microsoftIPv4Address; + + /* + * The IPv6 address of Microsoft at the exchange peering facility. + */ + @JsonProperty(value = "microsoftIPv6Address") + private String microsoftIPv6Address; + + /* + * The IPv4 prefixes associated with the exchange peering facility. + */ + @JsonProperty(value = "facilityIPv4Prefix") + private String facilityIPv4Prefix; + + /* + * The IPv6 prefixes associated with the exchange peering facility. + */ + @JsonProperty(value = "facilityIPv6Prefix") + private String facilityIPv6Prefix; + + /* + * The PeeringDB.com ID of the facility. + */ + @JsonProperty(value = "peeringDBFacilityId") + private Integer peeringDBFacilityId; + + /* + * The PeeringDB.com URL of the facility. + */ + @JsonProperty(value = "peeringDBFacilityLink") + private String peeringDBFacilityLink; + + /** + * Get the exchangeName property: The name of the exchange peering facility. + * + * @return the exchangeName value. + */ + public String exchangeName() { + return this.exchangeName; + } + + /** + * Set the exchangeName property: The name of the exchange peering facility. + * + * @param exchangeName the exchangeName value to set. + * @return the ExchangePeeringFacility object itself. + */ + public ExchangePeeringFacility withExchangeName(String exchangeName) { + this.exchangeName = exchangeName; + return this; + } + + /** + * Get the bandwidthInMbps property: The bandwidth of the connection between Microsoft and the exchange peering + * facility. + * + * @return the bandwidthInMbps value. + */ + public Integer bandwidthInMbps() { + return this.bandwidthInMbps; + } + + /** + * Set the bandwidthInMbps property: The bandwidth of the connection between Microsoft and the exchange peering + * facility. + * + * @param bandwidthInMbps the bandwidthInMbps value to set. + * @return the ExchangePeeringFacility object itself. + */ + public ExchangePeeringFacility withBandwidthInMbps(Integer bandwidthInMbps) { + this.bandwidthInMbps = bandwidthInMbps; + return this; + } + + /** + * Get the microsoftIPv4Address property: The IPv4 address of Microsoft at the exchange peering facility. + * + * @return the microsoftIPv4Address value. + */ + public String microsoftIPv4Address() { + return this.microsoftIPv4Address; + } + + /** + * Set the microsoftIPv4Address property: The IPv4 address of Microsoft at the exchange peering facility. + * + * @param microsoftIPv4Address the microsoftIPv4Address value to set. + * @return the ExchangePeeringFacility object itself. + */ + public ExchangePeeringFacility withMicrosoftIPv4Address(String microsoftIPv4Address) { + this.microsoftIPv4Address = microsoftIPv4Address; + return this; + } + + /** + * Get the microsoftIPv6Address property: The IPv6 address of Microsoft at the exchange peering facility. + * + * @return the microsoftIPv6Address value. + */ + public String microsoftIPv6Address() { + return this.microsoftIPv6Address; + } + + /** + * Set the microsoftIPv6Address property: The IPv6 address of Microsoft at the exchange peering facility. + * + * @param microsoftIPv6Address the microsoftIPv6Address value to set. + * @return the ExchangePeeringFacility object itself. + */ + public ExchangePeeringFacility withMicrosoftIPv6Address(String microsoftIPv6Address) { + this.microsoftIPv6Address = microsoftIPv6Address; + return this; + } + + /** + * Get the facilityIPv4Prefix property: The IPv4 prefixes associated with the exchange peering facility. + * + * @return the facilityIPv4Prefix value. + */ + public String facilityIPv4Prefix() { + return this.facilityIPv4Prefix; + } + + /** + * Set the facilityIPv4Prefix property: The IPv4 prefixes associated with the exchange peering facility. + * + * @param facilityIPv4Prefix the facilityIPv4Prefix value to set. + * @return the ExchangePeeringFacility object itself. + */ + public ExchangePeeringFacility withFacilityIPv4Prefix(String facilityIPv4Prefix) { + this.facilityIPv4Prefix = facilityIPv4Prefix; + return this; + } + + /** + * Get the facilityIPv6Prefix property: The IPv6 prefixes associated with the exchange peering facility. + * + * @return the facilityIPv6Prefix value. + */ + public String facilityIPv6Prefix() { + return this.facilityIPv6Prefix; + } + + /** + * Set the facilityIPv6Prefix property: The IPv6 prefixes associated with the exchange peering facility. + * + * @param facilityIPv6Prefix the facilityIPv6Prefix value to set. + * @return the ExchangePeeringFacility object itself. + */ + public ExchangePeeringFacility withFacilityIPv6Prefix(String facilityIPv6Prefix) { + this.facilityIPv6Prefix = facilityIPv6Prefix; + return this; + } + + /** + * Get the peeringDBFacilityId property: The PeeringDB.com ID of the facility. + * + * @return the peeringDBFacilityId value. + */ + public Integer peeringDBFacilityId() { + return this.peeringDBFacilityId; + } + + /** + * Set the peeringDBFacilityId property: The PeeringDB.com ID of the facility. + * + * @param peeringDBFacilityId the peeringDBFacilityId value to set. + * @return the ExchangePeeringFacility object itself. + */ + public ExchangePeeringFacility withPeeringDBFacilityId(Integer peeringDBFacilityId) { + this.peeringDBFacilityId = peeringDBFacilityId; + return this; + } + + /** + * Get the peeringDBFacilityLink property: The PeeringDB.com URL of the facility. + * + * @return the peeringDBFacilityLink value. + */ + public String peeringDBFacilityLink() { + return this.peeringDBFacilityLink; + } + + /** + * Set the peeringDBFacilityLink property: The PeeringDB.com URL of the facility. + * + * @param peeringDBFacilityLink the peeringDBFacilityLink value to set. + * @return the ExchangePeeringFacility object itself. + */ + public ExchangePeeringFacility withPeeringDBFacilityLink(String peeringDBFacilityLink) { + this.peeringDBFacilityLink = peeringDBFacilityLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Family.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Family.java new file mode 100644 index 000000000000..e8b8a5a0ed9a --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Family.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.peering.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Family. */ +public final class Family extends ExpandableStringEnum { + /** Static value Direct for Family. */ + public static final Family DIRECT = fromString("Direct"); + + /** Static value Exchange for Family. */ + public static final Family EXCHANGE = fromString("Exchange"); + + /** + * Creates or finds a Family from its string representation. + * + * @param name a name to look for. + * @return the corresponding Family. + */ + @JsonCreator + public static Family fromString(String name) { + return fromString(name, Family.class); + } + + /** @return known Family values. */ + public static Collection values() { + return values(Family.class); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Kind.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Kind.java new file mode 100644 index 000000000000..f803b94cb2f3 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Kind.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.peering.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Kind. */ +public final class Kind extends ExpandableStringEnum { + /** Static value Direct for Kind. */ + public static final Kind DIRECT = fromString("Direct"); + + /** Static value Exchange for Kind. */ + public static final Kind EXCHANGE = fromString("Exchange"); + + /** + * Creates or finds a Kind from its string representation. + * + * @param name a name to look for. + * @return the corresponding Kind. + */ + @JsonCreator + public static Kind fromString(String name) { + return fromString(name, Kind.class); + } + + /** @return known Kind values. */ + public static Collection values() { + return values(Kind.class); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/LearnedType.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/LearnedType.java new file mode 100644 index 000000000000..a0286db76b3d --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/LearnedType.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.peering.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for LearnedType. */ +public final class LearnedType extends ExpandableStringEnum { + /** Static value None for LearnedType. */ + public static final LearnedType NONE = fromString("None"); + + /** Static value ViaPartner for LearnedType. */ + public static final LearnedType VIA_PARTNER = fromString("ViaPartner"); + + /** Static value ViaSession for LearnedType. */ + public static final LearnedType VIA_SESSION = fromString("ViaSession"); + + /** + * Creates or finds a LearnedType from its string representation. + * + * @param name a name to look for. + * @return the corresponding LearnedType. + */ + @JsonCreator + public static LearnedType fromString(String name) { + return fromString(name, LearnedType.class); + } + + /** @return known LearnedType values. */ + public static Collection values() { + return values(LearnedType.class); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/LegacyPeerings.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/LegacyPeerings.java new file mode 100644 index 000000000000..0c0fc2ab7437 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/LegacyPeerings.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of LegacyPeerings. */ +public interface LegacyPeerings { + /** + * Lists all of the legacy peerings under the given subscription matching the specified kind and location. + * + * @param peeringLocation The location of the peering. + * @param kind The kind of the peering. + * @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 paginated list of peerings. + */ + PagedIterable list(String peeringLocation, LegacyPeeringsKind kind); + + /** + * Lists all of the legacy peerings under the given subscription matching the specified kind and location. + * + * @param peeringLocation The location of the peering. + * @param kind The kind of the peering. + * @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 paginated list of peerings. + */ + PagedIterable list(String peeringLocation, LegacyPeeringsKind kind, Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/LegacyPeeringsKind.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/LegacyPeeringsKind.java new file mode 100644 index 000000000000..740c35f38e41 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/LegacyPeeringsKind.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.peering.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for LegacyPeeringsKind. */ +public final class LegacyPeeringsKind extends ExpandableStringEnum { + /** Static value Direct for LegacyPeeringsKind. */ + public static final LegacyPeeringsKind DIRECT = fromString("Direct"); + + /** Static value Exchange for LegacyPeeringsKind. */ + public static final LegacyPeeringsKind EXCHANGE = fromString("Exchange"); + + /** + * Creates or finds a LegacyPeeringsKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding LegacyPeeringsKind. + */ + @JsonCreator + public static LegacyPeeringsKind fromString(String name) { + return fromString(name, LegacyPeeringsKind.class); + } + + /** @return known LegacyPeeringsKind values. */ + public static Collection values() { + return values(LegacyPeeringsKind.class); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Name.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Name.java new file mode 100644 index 000000000000..460f07334167 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Name.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.peering.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Name. */ +public final class Name extends ExpandableStringEnum { + /** Static value Basic_Exchange_Free for Name. */ + public static final Name BASIC_EXCHANGE_FREE = fromString("Basic_Exchange_Free"); + + /** Static value Basic_Direct_Free for Name. */ + public static final Name BASIC_DIRECT_FREE = fromString("Basic_Direct_Free"); + + /** Static value Premium_Direct_Free for Name. */ + public static final Name PREMIUM_DIRECT_FREE = fromString("Premium_Direct_Free"); + + /** Static value Premium_Exchange_Metered for Name. */ + public static final Name PREMIUM_EXCHANGE_METERED = fromString("Premium_Exchange_Metered"); + + /** Static value Premium_Direct_Metered for Name. */ + public static final Name PREMIUM_DIRECT_METERED = fromString("Premium_Direct_Metered"); + + /** Static value Premium_Direct_Unlimited for Name. */ + public static final Name PREMIUM_DIRECT_UNLIMITED = fromString("Premium_Direct_Unlimited"); + + /** + * Creates or finds a Name from its string representation. + * + * @param name a name to look for. + * @return the corresponding Name. + */ + @JsonCreator + public static Name fromString(String name) { + return fromString(name, Name.class); + } + + /** @return known Name values. */ + public static Collection values() { + return values(Name.class); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Operation.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Operation.java new file mode 100644 index 000000000000..37e6ba4d7543 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Operation.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.peering.models; + +import com.azure.resourcemanager.peering.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: The name of the operation. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: The information related to the operation. + * + * @return the display value. + */ + OperationDisplayInfo display(); + + /** + * Gets the isDataAction property: The flag that indicates whether the operation applies to data plane. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the inner com.azure.resourcemanager.peering.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/OperationDisplayInfo.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/OperationDisplayInfo.java new file mode 100644 index 000000000000..4f2b502131f2 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/OperationDisplayInfo.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.peering.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The information related to the operation. */ +@Immutable +public final class OperationDisplayInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplayInfo.class); + + /* + * The name of the resource provider. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * The type of the resource. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The name of the operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The description of the operation. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the provider property: The name of the resource provider. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The type of the resource. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The name of the operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The description of the operation. + * + * @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/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/OperationListResult.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/OperationListResult.java new file mode 100644 index 000000000000..f5397a6a3c91 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/OperationListResult.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.peering.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The paginated list of peering API operations. */ +@Fluent +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * The list of peering API operations. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link to fetch the next page of peering API operations. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of peering API operations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of peering API operations. + * + * @param value the value value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to fetch the next page of peering API operations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to fetch the next page of peering API operations. + * + * @param nextLink the nextLink value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + 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/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Operations.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Operations.java new file mode 100644 index 000000000000..c09167cf50fb --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all of the available API operations for peering resources. + * + * @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 paginated list of peering API operations. + */ + PagedIterable list(); + + /** + * Lists all of the available API operations for peering resources. + * + * @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 paginated list of peering API operations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeerAsn.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeerAsn.java new file mode 100644 index 000000000000..23fd7df74263 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeerAsn.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.peering.fluent.models.PeerAsnInner; + +/** An immutable client-side representation of PeerAsn. */ +public interface PeerAsn { + /** + * 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 peerAsn property: The Autonomous System Number (ASN) of the peer. + * + * @return the peerAsn value. + */ + Integer peerAsn(); + + /** + * Gets the peerContactInfo property: The contact information of the peer. + * + * @return the peerContactInfo value. + */ + ContactInfo peerContactInfo(); + + /** + * Gets the peerName property: The name of the peer. + * + * @return the peerName value. + */ + String peerName(); + + /** + * Gets the validationState property: The validation state of the ASN associated with the peer. + * + * @return the validationState value. + */ + ValidationState validationState(); + + /** + * Gets the inner com.azure.resourcemanager.peering.fluent.models.PeerAsnInner object. + * + * @return the inner object. + */ + PeerAsnInner innerModel(); + + /** The entirety of the PeerAsn definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { + } + /** The PeerAsn definition stages. */ + interface DefinitionStages { + /** The first stage of the PeerAsn definition. */ + interface Blank extends WithCreate { + } + /** + * The stage of the PeerAsn 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.WithPeerAsn, + DefinitionStages.WithPeerContactInfo, + DefinitionStages.WithPeerName, + DefinitionStages.WithValidationState { + /** + * Executes the create request. + * + * @return the created resource. + */ + PeerAsn create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PeerAsn create(Context context); + } + /** The stage of the PeerAsn definition allowing to specify peerAsn. */ + interface WithPeerAsn { + /** + * Specifies the peerAsn property: The Autonomous System Number (ASN) of the peer.. + * + * @param peerAsn The Autonomous System Number (ASN) of the peer. + * @return the next definition stage. + */ + WithCreate withPeerAsn(Integer peerAsn); + } + /** The stage of the PeerAsn definition allowing to specify peerContactInfo. */ + interface WithPeerContactInfo { + /** + * Specifies the peerContactInfo property: The contact information of the peer.. + * + * @param peerContactInfo The contact information of the peer. + * @return the next definition stage. + */ + WithCreate withPeerContactInfo(ContactInfo peerContactInfo); + } + /** The stage of the PeerAsn definition allowing to specify peerName. */ + interface WithPeerName { + /** + * Specifies the peerName property: The name of the peer.. + * + * @param peerName The name of the peer. + * @return the next definition stage. + */ + WithCreate withPeerName(String peerName); + } + /** The stage of the PeerAsn definition allowing to specify validationState. */ + interface WithValidationState { + /** + * Specifies the validationState property: The validation state of the ASN associated with the peer.. + * + * @param validationState The validation state of the ASN associated with the peer. + * @return the next definition stage. + */ + WithCreate withValidationState(ValidationState validationState); + } + } + /** + * Begins update for the PeerAsn resource. + * + * @return the stage of resource update. + */ + PeerAsn.Update update(); + + /** The template for PeerAsn update. */ + interface Update + extends UpdateStages.WithPeerAsn, + UpdateStages.WithPeerContactInfo, + UpdateStages.WithPeerName, + UpdateStages.WithValidationState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PeerAsn apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PeerAsn apply(Context context); + } + /** The PeerAsn update stages. */ + interface UpdateStages { + /** The stage of the PeerAsn update allowing to specify peerAsn. */ + interface WithPeerAsn { + /** + * Specifies the peerAsn property: The Autonomous System Number (ASN) of the peer.. + * + * @param peerAsn The Autonomous System Number (ASN) of the peer. + * @return the next definition stage. + */ + Update withPeerAsn(Integer peerAsn); + } + /** The stage of the PeerAsn update allowing to specify peerContactInfo. */ + interface WithPeerContactInfo { + /** + * Specifies the peerContactInfo property: The contact information of the peer.. + * + * @param peerContactInfo The contact information of the peer. + * @return the next definition stage. + */ + Update withPeerContactInfo(ContactInfo peerContactInfo); + } + /** The stage of the PeerAsn update allowing to specify peerName. */ + interface WithPeerName { + /** + * Specifies the peerName property: The name of the peer.. + * + * @param peerName The name of the peer. + * @return the next definition stage. + */ + Update withPeerName(String peerName); + } + /** The stage of the PeerAsn update allowing to specify validationState. */ + interface WithValidationState { + /** + * Specifies the validationState property: The validation state of the ASN associated with the peer.. + * + * @param validationState The validation state of the ASN associated with the peer. + * @return the next definition stage. + */ + Update withValidationState(ValidationState validationState); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PeerAsn refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PeerAsn refresh(Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeerAsnListResult.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeerAsnListResult.java new file mode 100644 index 000000000000..e78c575edafb --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeerAsnListResult.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.peering.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.fluent.models.PeerAsnInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The paginated list of peer ASNs. */ +@Fluent +public final class PeerAsnListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeerAsnListResult.class); + + /* + * The list of peer ASNs. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link to fetch the next page of peer ASNs. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of peer ASNs. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of peer ASNs. + * + * @param value the value value to set. + * @return the PeerAsnListResult object itself. + */ + public PeerAsnListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to fetch the next page of peer ASNs. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to fetch the next page of peer ASNs. + * + * @param nextLink the nextLink value to set. + * @return the PeerAsnListResult object itself. + */ + public PeerAsnListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + 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/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeerAsns.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeerAsns.java new file mode 100644 index 000000000000..a192acdc729f --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeerAsns.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.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 PeerAsns. */ +public interface PeerAsns { + /** + * Gets the peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN 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 peer ASN with the specified name under the given subscription. + */ + PeerAsn get(String peerAsnName); + + /** + * Gets the peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN 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 peer ASN with the specified name under the given subscription. + */ + Response getWithResponse(String peerAsnName, Context context); + + /** + * Deletes an existing peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN 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 delete(String peerAsnName); + + /** + * Deletes an existing peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String peerAsnName, Context context); + + /** + * Lists all of the peer ASNs under the given subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peer ASNs. + */ + PagedIterable list(); + + /** + * Lists all of the peer ASNs under the given subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peer ASNs. + */ + PagedIterable list(Context context); + + /** + * Gets the peer ASN with the specified name under the given subscription. + * + * @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 peer ASN with the specified name under the given subscription. + */ + PeerAsn getById(String id); + + /** + * Gets the peer ASN with the specified name under the given subscription. + * + * @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 peer ASN with the specified name under the given subscription. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an existing peer ASN with the specified name under the given subscription. + * + * @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 an existing peer ASN with the specified name under the given subscription. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new PeerAsn resource. + * + * @param name resource name. + * @return the first stage of the new PeerAsn definition. + */ + PeerAsn.DefinitionStages.Blank define(String name); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Peering.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Peering.java new file mode 100644 index 000000000000..bd0f5712ce46 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Peering.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.peering.fluent.models.PeeringInner; +import java.util.Map; + +/** An immutable client-side representation of Peering. */ +public interface Peering { + /** + * 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 sku property: The SKU that defines the tier and kind of the peering. + * + * @return the sku value. + */ + PeeringSku sku(); + + /** + * Gets the kind property: The kind of the peering. + * + * @return the kind value. + */ + Kind kind(); + + /** + * Gets the location property: The location of the resource. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: The resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the direct property: The properties that define a direct peering. + * + * @return the direct value. + */ + PeeringPropertiesDirect direct(); + + /** + * Gets the exchange property: The properties that define an exchange peering. + * + * @return the exchange value. + */ + PeeringPropertiesExchange exchange(); + + /** + * Gets the peeringLocation property: The location of the peering. + * + * @return the peeringLocation value. + */ + String peeringLocation(); + + /** + * Gets the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.peering.fluent.models.PeeringInner object. + * + * @return the inner object. + */ + PeeringInner innerModel(); + + /** The entirety of the Peering definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithSku, + DefinitionStages.WithKind, + DefinitionStages.WithCreate { + } + /** The Peering definition stages. */ + interface DefinitionStages { + /** The first stage of the Peering definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Peering definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The location of the resource. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The location of the resource. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the Peering definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithSku withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the Peering definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The SKU that defines the tier and kind of the peering.. + * + * @param sku The SKU that defines the tier and kind of the peering. + * @return the next definition stage. + */ + WithKind withSku(PeeringSku sku); + } + /** The stage of the Peering definition allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: The kind of the peering.. + * + * @param kind The kind of the peering. + * @return the next definition stage. + */ + WithCreate withKind(Kind kind); + } + /** + * The stage of the Peering definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithDirect, + DefinitionStages.WithExchange, + DefinitionStages.WithPeeringLocation { + /** + * Executes the create request. + * + * @return the created resource. + */ + Peering create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Peering create(Context context); + } + /** The stage of the Peering definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The resource tags.. + * + * @param tags The resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the Peering definition allowing to specify direct. */ + interface WithDirect { + /** + * Specifies the direct property: The properties that define a direct peering.. + * + * @param direct The properties that define a direct peering. + * @return the next definition stage. + */ + WithCreate withDirect(PeeringPropertiesDirect direct); + } + /** The stage of the Peering definition allowing to specify exchange. */ + interface WithExchange { + /** + * Specifies the exchange property: The properties that define an exchange peering.. + * + * @param exchange The properties that define an exchange peering. + * @return the next definition stage. + */ + WithCreate withExchange(PeeringPropertiesExchange exchange); + } + /** The stage of the Peering definition allowing to specify peeringLocation. */ + interface WithPeeringLocation { + /** + * Specifies the peeringLocation property: The location of the peering.. + * + * @param peeringLocation The location of the peering. + * @return the next definition stage. + */ + WithCreate withPeeringLocation(String peeringLocation); + } + } + /** + * Begins update for the Peering resource. + * + * @return the stage of resource update. + */ + Peering.Update update(); + + /** The template for Peering update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Peering apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Peering apply(Context context); + } + /** The Peering update stages. */ + interface UpdateStages { + /** The stage of the Peering update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Gets or sets the tags, a dictionary of descriptors arm object. + * + * @param tags Gets or sets the tags, a dictionary of descriptors arm object. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Peering refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Peering refresh(Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringBandwidthOffer.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringBandwidthOffer.java new file mode 100644 index 000000000000..525d2f09f92e --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringBandwidthOffer.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.peering.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties that define a peering bandwidth offer. */ +@Fluent +public final class PeeringBandwidthOffer { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringBandwidthOffer.class); + + /* + * The name of the bandwidth offer. + */ + @JsonProperty(value = "offerName") + private String offerName; + + /* + * The value of the bandwidth offer in Mbps. + */ + @JsonProperty(value = "valueInMbps") + private Integer valueInMbps; + + /** + * Get the offerName property: The name of the bandwidth offer. + * + * @return the offerName value. + */ + public String offerName() { + return this.offerName; + } + + /** + * Set the offerName property: The name of the bandwidth offer. + * + * @param offerName the offerName value to set. + * @return the PeeringBandwidthOffer object itself. + */ + public PeeringBandwidthOffer withOfferName(String offerName) { + this.offerName = offerName; + return this; + } + + /** + * Get the valueInMbps property: The value of the bandwidth offer in Mbps. + * + * @return the valueInMbps value. + */ + public Integer valueInMbps() { + return this.valueInMbps; + } + + /** + * Set the valueInMbps property: The value of the bandwidth offer in Mbps. + * + * @param valueInMbps the valueInMbps value to set. + * @return the PeeringBandwidthOffer object itself. + */ + public PeeringBandwidthOffer withValueInMbps(Integer valueInMbps) { + this.valueInMbps = valueInMbps; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringListResult.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringListResult.java new file mode 100644 index 000000000000..e40e5457ce10 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringListResult.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.peering.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.fluent.models.PeeringInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The paginated list of peerings. */ +@Fluent +public final class PeeringListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringListResult.class); + + /* + * The list of peerings. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link to fetch the next page of peerings. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of peerings. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of peerings. + * + * @param value the value value to set. + * @return the PeeringListResult object itself. + */ + public PeeringListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to fetch the next page of peerings. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to fetch the next page of peerings. + * + * @param nextLink the nextLink value to set. + * @return the PeeringListResult object itself. + */ + public PeeringListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + 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/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringLocation.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringLocation.java new file mode 100644 index 000000000000..288de60628cf --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringLocation.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.peering.models; + +import com.azure.resourcemanager.peering.fluent.models.PeeringLocationInner; + +/** An immutable client-side representation of PeeringLocation. */ +public interface PeeringLocation { + /** + * 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 kind property: The kind of peering that the peering location supports. + * + * @return the kind value. + */ + Kind kind(); + + /** + * Gets the direct property: The properties that define a direct peering location. + * + * @return the direct value. + */ + PeeringLocationPropertiesDirect direct(); + + /** + * Gets the exchange property: The properties that define an exchange peering location. + * + * @return the exchange value. + */ + PeeringLocationPropertiesExchange exchange(); + + /** + * Gets the peeringLocation property: The name of the peering location. + * + * @return the peeringLocation value. + */ + String peeringLocation(); + + /** + * Gets the country property: The country in which the peering location exists. + * + * @return the country value. + */ + String country(); + + /** + * Gets the azureRegion property: The Azure region associated with the peering location. + * + * @return the azureRegion value. + */ + String azureRegion(); + + /** + * Gets the inner com.azure.resourcemanager.peering.fluent.models.PeeringLocationInner object. + * + * @return the inner object. + */ + PeeringLocationInner innerModel(); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringLocationListResult.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringLocationListResult.java new file mode 100644 index 000000000000..1cd4c918f61b --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringLocationListResult.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.peering.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.fluent.models.PeeringLocationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The paginated list of peering locations. */ +@Fluent +public final class PeeringLocationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringLocationListResult.class); + + /* + * The list of peering locations. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link to fetch the next page of peering locations. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of peering locations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of peering locations. + * + * @param value the value value to set. + * @return the PeeringLocationListResult object itself. + */ + public PeeringLocationListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to fetch the next page of peering locations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to fetch the next page of peering locations. + * + * @param nextLink the nextLink value to set. + * @return the PeeringLocationListResult object itself. + */ + public PeeringLocationListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + 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/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringLocationPropertiesDirect.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringLocationPropertiesDirect.java new file mode 100644 index 000000000000..cf58f366bd44 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringLocationPropertiesDirect.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The properties that define a direct peering location. */ +@Fluent +public final class PeeringLocationPropertiesDirect { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringLocationPropertiesDirect.class); + + /* + * The list of direct peering facilities at the peering location. + */ + @JsonProperty(value = "peeringFacilities") + private List peeringFacilities; + + /* + * The list of bandwidth offers available at the peering location. + */ + @JsonProperty(value = "bandwidthOffers") + private List bandwidthOffers; + + /** + * Get the peeringFacilities property: The list of direct peering facilities at the peering location. + * + * @return the peeringFacilities value. + */ + public List peeringFacilities() { + return this.peeringFacilities; + } + + /** + * Set the peeringFacilities property: The list of direct peering facilities at the peering location. + * + * @param peeringFacilities the peeringFacilities value to set. + * @return the PeeringLocationPropertiesDirect object itself. + */ + public PeeringLocationPropertiesDirect withPeeringFacilities(List peeringFacilities) { + this.peeringFacilities = peeringFacilities; + return this; + } + + /** + * Get the bandwidthOffers property: The list of bandwidth offers available at the peering location. + * + * @return the bandwidthOffers value. + */ + public List bandwidthOffers() { + return this.bandwidthOffers; + } + + /** + * Set the bandwidthOffers property: The list of bandwidth offers available at the peering location. + * + * @param bandwidthOffers the bandwidthOffers value to set. + * @return the PeeringLocationPropertiesDirect object itself. + */ + public PeeringLocationPropertiesDirect withBandwidthOffers(List bandwidthOffers) { + this.bandwidthOffers = bandwidthOffers; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (peeringFacilities() != null) { + peeringFacilities().forEach(e -> e.validate()); + } + if (bandwidthOffers() != null) { + bandwidthOffers().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringLocationPropertiesExchange.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringLocationPropertiesExchange.java new file mode 100644 index 000000000000..1cbaada2a4ac --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringLocationPropertiesExchange.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The properties that define an exchange peering location. */ +@Fluent +public final class PeeringLocationPropertiesExchange { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringLocationPropertiesExchange.class); + + /* + * The list of exchange peering facilities at the peering location. + */ + @JsonProperty(value = "peeringFacilities") + private List peeringFacilities; + + /** + * Get the peeringFacilities property: The list of exchange peering facilities at the peering location. + * + * @return the peeringFacilities value. + */ + public List peeringFacilities() { + return this.peeringFacilities; + } + + /** + * Set the peeringFacilities property: The list of exchange peering facilities at the peering location. + * + * @param peeringFacilities the peeringFacilities value to set. + * @return the PeeringLocationPropertiesExchange object itself. + */ + public PeeringLocationPropertiesExchange withPeeringFacilities(List peeringFacilities) { + this.peeringFacilities = peeringFacilities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (peeringFacilities() != null) { + peeringFacilities().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringLocations.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringLocations.java new file mode 100644 index 000000000000..2628f5048fa6 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringLocations.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of PeeringLocations. */ +public interface PeeringLocations { + /** + * Lists all of the available peering locations for the specified kind of peering. + * + * @param kind The kind of the peering. + * @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 paginated list of peering locations. + */ + PagedIterable list(PeeringLocationsKind kind); + + /** + * Lists all of the available peering locations for the specified kind of peering. + * + * @param kind The kind of the peering. + * @param directPeeringType The type of direct peering. + * @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 paginated list of peering locations. + */ + PagedIterable list( + PeeringLocationsKind kind, PeeringLocationsDirectPeeringType directPeeringType, Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringLocationsDirectPeeringType.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringLocationsDirectPeeringType.java new file mode 100644 index 000000000000..bd1a356b9b56 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringLocationsDirectPeeringType.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PeeringLocationsDirectPeeringType. */ +public final class PeeringLocationsDirectPeeringType extends ExpandableStringEnum { + /** Static value Edge for PeeringLocationsDirectPeeringType. */ + public static final PeeringLocationsDirectPeeringType EDGE = fromString("Edge"); + + /** Static value Transit for PeeringLocationsDirectPeeringType. */ + public static final PeeringLocationsDirectPeeringType TRANSIT = fromString("Transit"); + + /** Static value Cdn for PeeringLocationsDirectPeeringType. */ + public static final PeeringLocationsDirectPeeringType CDN = fromString("Cdn"); + + /** Static value Internal for PeeringLocationsDirectPeeringType. */ + public static final PeeringLocationsDirectPeeringType INTERNAL = fromString("Internal"); + + /** + * Creates or finds a PeeringLocationsDirectPeeringType from its string representation. + * + * @param name a name to look for. + * @return the corresponding PeeringLocationsDirectPeeringType. + */ + @JsonCreator + public static PeeringLocationsDirectPeeringType fromString(String name) { + return fromString(name, PeeringLocationsDirectPeeringType.class); + } + + /** @return known PeeringLocationsDirectPeeringType values. */ + public static Collection values() { + return values(PeeringLocationsDirectPeeringType.class); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringLocationsKind.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringLocationsKind.java new file mode 100644 index 000000000000..ee9102c416b4 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringLocationsKind.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.peering.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PeeringLocationsKind. */ +public final class PeeringLocationsKind extends ExpandableStringEnum { + /** Static value Direct for PeeringLocationsKind. */ + public static final PeeringLocationsKind DIRECT = fromString("Direct"); + + /** Static value Exchange for PeeringLocationsKind. */ + public static final PeeringLocationsKind EXCHANGE = fromString("Exchange"); + + /** + * Creates or finds a PeeringLocationsKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding PeeringLocationsKind. + */ + @JsonCreator + public static PeeringLocationsKind fromString(String name) { + return fromString(name, PeeringLocationsKind.class); + } + + /** @return known PeeringLocationsKind values. */ + public static Collection values() { + return values(PeeringLocationsKind.class); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringPropertiesDirect.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringPropertiesDirect.java new file mode 100644 index 000000000000..299caaf9fb76 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringPropertiesDirect.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The properties that define a direct peering. */ +@Fluent +public final class PeeringPropertiesDirect { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringPropertiesDirect.class); + + /* + * The set of connections that constitute a direct peering. + */ + @JsonProperty(value = "connections") + private List connections; + + /* + * The flag that indicates whether or not the peering is used for peering + * service. + */ + @JsonProperty(value = "useForPeeringService") + private Boolean useForPeeringService; + + /* + * The reference of the peer ASN. + */ + @JsonProperty(value = "peerAsn") + private SubResource peerAsn; + + /* + * The type of direct peering. + */ + @JsonProperty(value = "directPeeringType") + private DirectPeeringType directPeeringType; + + /** + * Get the connections property: The set of connections that constitute a direct peering. + * + * @return the connections value. + */ + public List connections() { + return this.connections; + } + + /** + * Set the connections property: The set of connections that constitute a direct peering. + * + * @param connections the connections value to set. + * @return the PeeringPropertiesDirect object itself. + */ + public PeeringPropertiesDirect withConnections(List connections) { + this.connections = connections; + return this; + } + + /** + * Get the useForPeeringService property: The flag that indicates whether or not the peering is used for peering + * service. + * + * @return the useForPeeringService value. + */ + public Boolean useForPeeringService() { + return this.useForPeeringService; + } + + /** + * Set the useForPeeringService property: The flag that indicates whether or not the peering is used for peering + * service. + * + * @param useForPeeringService the useForPeeringService value to set. + * @return the PeeringPropertiesDirect object itself. + */ + public PeeringPropertiesDirect withUseForPeeringService(Boolean useForPeeringService) { + this.useForPeeringService = useForPeeringService; + return this; + } + + /** + * Get the peerAsn property: The reference of the peer ASN. + * + * @return the peerAsn value. + */ + public SubResource peerAsn() { + return this.peerAsn; + } + + /** + * Set the peerAsn property: The reference of the peer ASN. + * + * @param peerAsn the peerAsn value to set. + * @return the PeeringPropertiesDirect object itself. + */ + public PeeringPropertiesDirect withPeerAsn(SubResource peerAsn) { + this.peerAsn = peerAsn; + return this; + } + + /** + * Get the directPeeringType property: The type of direct peering. + * + * @return the directPeeringType value. + */ + public DirectPeeringType directPeeringType() { + return this.directPeeringType; + } + + /** + * Set the directPeeringType property: The type of direct peering. + * + * @param directPeeringType the directPeeringType value to set. + * @return the PeeringPropertiesDirect object itself. + */ + public PeeringPropertiesDirect withDirectPeeringType(DirectPeeringType directPeeringType) { + this.directPeeringType = directPeeringType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (connections() != null) { + connections().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringPropertiesExchange.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringPropertiesExchange.java new file mode 100644 index 000000000000..ee7b08f8af44 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringPropertiesExchange.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.peering.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The properties that define an exchange peering. */ +@Fluent +public final class PeeringPropertiesExchange { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringPropertiesExchange.class); + + /* + * The set of connections that constitute an exchange peering. + */ + @JsonProperty(value = "connections") + private List connections; + + /* + * The reference of the peer ASN. + */ + @JsonProperty(value = "peerAsn") + private SubResource peerAsn; + + /** + * Get the connections property: The set of connections that constitute an exchange peering. + * + * @return the connections value. + */ + public List connections() { + return this.connections; + } + + /** + * Set the connections property: The set of connections that constitute an exchange peering. + * + * @param connections the connections value to set. + * @return the PeeringPropertiesExchange object itself. + */ + public PeeringPropertiesExchange withConnections(List connections) { + this.connections = connections; + return this; + } + + /** + * Get the peerAsn property: The reference of the peer ASN. + * + * @return the peerAsn value. + */ + public SubResource peerAsn() { + return this.peerAsn; + } + + /** + * Set the peerAsn property: The reference of the peer ASN. + * + * @param peerAsn the peerAsn value to set. + * @return the PeeringPropertiesExchange object itself. + */ + public PeeringPropertiesExchange withPeerAsn(SubResource peerAsn) { + this.peerAsn = peerAsn; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (connections() != null) { + connections().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringService.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringService.java new file mode 100644 index 000000000000..a82405819a90 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringService.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.peering.fluent.models.PeeringServiceInner; +import java.util.Map; + +/** An immutable client-side representation of PeeringService. */ +public interface PeeringService { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The location of the resource. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: The resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the peeringServiceLocation property: The PeeringServiceLocation of the Customer. + * + * @return the peeringServiceLocation value. + */ + String peeringServiceLocation(); + + /** + * Gets the peeringServiceProvider property: The MAPS Provider Name. + * + * @return the peeringServiceProvider value. + */ + String peeringServiceProvider(); + + /** + * Gets the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.peering.fluent.models.PeeringServiceInner object. + * + * @return the inner object. + */ + PeeringServiceInner innerModel(); + + /** The entirety of the PeeringService definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The PeeringService definition stages. */ + interface DefinitionStages { + /** The first stage of the PeeringService definition. */ + interface Blank extends WithLocation { + } + /** The stage of the PeeringService definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The location of the resource. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The location of the resource. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the PeeringService definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the PeeringService definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithPeeringServiceLocation, + DefinitionStages.WithPeeringServiceProvider { + /** + * Executes the create request. + * + * @return the created resource. + */ + PeeringService create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PeeringService create(Context context); + } + /** The stage of the PeeringService definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The resource tags.. + * + * @param tags The resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the PeeringService definition allowing to specify peeringServiceLocation. */ + interface WithPeeringServiceLocation { + /** + * Specifies the peeringServiceLocation property: The PeeringServiceLocation of the Customer.. + * + * @param peeringServiceLocation The PeeringServiceLocation of the Customer. + * @return the next definition stage. + */ + WithCreate withPeeringServiceLocation(String peeringServiceLocation); + } + /** The stage of the PeeringService definition allowing to specify peeringServiceProvider. */ + interface WithPeeringServiceProvider { + /** + * Specifies the peeringServiceProvider property: The MAPS Provider Name.. + * + * @param peeringServiceProvider The MAPS Provider Name. + * @return the next definition stage. + */ + WithCreate withPeeringServiceProvider(String peeringServiceProvider); + } + } + /** + * Begins update for the PeeringService resource. + * + * @return the stage of resource update. + */ + PeeringService.Update update(); + + /** The template for PeeringService update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PeeringService apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PeeringService apply(Context context); + } + /** The PeeringService update stages. */ + interface UpdateStages { + /** The stage of the PeeringService update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Gets or sets the tags, a dictionary of descriptors arm object. + * + * @param tags Gets or sets the tags, a dictionary of descriptors arm object. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PeeringService refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PeeringService refresh(Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceListResult.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceListResult.java new file mode 100644 index 000000000000..1613758bbdda --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceListResult.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.peering.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.fluent.models.PeeringServiceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The paginated list of peering services. */ +@Fluent +public final class PeeringServiceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringServiceListResult.class); + + /* + * The list of peering services. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link to fetch the next page of peering services. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of peering services. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of peering services. + * + * @param value the value value to set. + * @return the PeeringServiceListResult object itself. + */ + public PeeringServiceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to fetch the next page of peering services. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to fetch the next page of peering services. + * + * @param nextLink the nextLink value to set. + * @return the PeeringServiceListResult object itself. + */ + public PeeringServiceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + 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/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceLocation.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceLocation.java new file mode 100644 index 000000000000..804eb8f1a1f2 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceLocation.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.peering.models; + +import com.azure.resourcemanager.peering.fluent.models.PeeringServiceLocationInner; + +/** An immutable client-side representation of PeeringServiceLocation. */ +public interface PeeringServiceLocation { + /** + * 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 country property: Country of the customer. + * + * @return the country value. + */ + String country(); + + /** + * Gets the state property: State of the customer. + * + * @return the state value. + */ + String state(); + + /** + * Gets the azureRegion property: Azure region for the location. + * + * @return the azureRegion value. + */ + String azureRegion(); + + /** + * Gets the inner com.azure.resourcemanager.peering.fluent.models.PeeringServiceLocationInner object. + * + * @return the inner object. + */ + PeeringServiceLocationInner innerModel(); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceLocationListResult.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceLocationListResult.java new file mode 100644 index 000000000000..a47a823bdb9d --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceLocationListResult.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.peering.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.fluent.models.PeeringServiceLocationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The paginated list of peering service locations. */ +@Fluent +public final class PeeringServiceLocationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringServiceLocationListResult.class); + + /* + * The list of peering service locations. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link to fetch the next page of peering service locations. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of peering service locations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of peering service locations. + * + * @param value the value value to set. + * @return the PeeringServiceLocationListResult object itself. + */ + public PeeringServiceLocationListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to fetch the next page of peering service locations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to fetch the next page of peering service locations. + * + * @param nextLink the nextLink value to set. + * @return the PeeringServiceLocationListResult object itself. + */ + public PeeringServiceLocationListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + 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/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceLocations.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceLocations.java new file mode 100644 index 000000000000..9608f27e3455 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceLocations.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.peering.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of PeeringServiceLocations. */ +public interface PeeringServiceLocations { + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @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 paginated list of peering service locations. + */ + PagedIterable list(); + + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @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 paginated list of peering service locations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServicePrefix.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServicePrefix.java new file mode 100644 index 000000000000..d0b30e7f88fb --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServicePrefix.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.peering.fluent.models.PeeringServicePrefixInner; + +/** An immutable client-side representation of PeeringServicePrefix. */ +public interface PeeringServicePrefix { + /** + * 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 prefix property: Valid route prefix. + * + * @return the prefix value. + */ + String prefix(); + + /** + * Gets the prefixValidationState property: The prefix validation state. + * + * @return the prefixValidationState value. + */ + PrefixValidationState prefixValidationState(); + + /** + * Gets the learnedType property: The prefix learned type. + * + * @return the learnedType value. + */ + LearnedType learnedType(); + + /** + * Gets the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.peering.fluent.models.PeeringServicePrefixInner object. + * + * @return the inner object. + */ + PeeringServicePrefixInner innerModel(); + + /** The entirety of the PeeringServicePrefix definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The PeeringServicePrefix definition stages. */ + interface DefinitionStages { + /** The first stage of the PeeringServicePrefix definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the PeeringServicePrefix definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, peeringServiceName. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @return the next definition stage. + */ + WithCreate withExistingPeeringService(String resourceGroupName, String peeringServiceName); + } + /** + * The stage of the PeeringServicePrefix 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.WithPrefix, + DefinitionStages.WithPrefixValidationState, + DefinitionStages.WithLearnedType { + /** + * Executes the create request. + * + * @return the created resource. + */ + PeeringServicePrefix create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PeeringServicePrefix create(Context context); + } + /** The stage of the PeeringServicePrefix definition allowing to specify prefix. */ + interface WithPrefix { + /** + * Specifies the prefix property: Valid route prefix. + * + * @param prefix Valid route prefix. + * @return the next definition stage. + */ + WithCreate withPrefix(String prefix); + } + /** The stage of the PeeringServicePrefix definition allowing to specify prefixValidationState. */ + interface WithPrefixValidationState { + /** + * Specifies the prefixValidationState property: The prefix validation state. + * + * @param prefixValidationState The prefix validation state. + * @return the next definition stage. + */ + WithCreate withPrefixValidationState(PrefixValidationState prefixValidationState); + } + /** The stage of the PeeringServicePrefix definition allowing to specify learnedType. */ + interface WithLearnedType { + /** + * Specifies the learnedType property: The prefix learned type. + * + * @param learnedType The prefix learned type. + * @return the next definition stage. + */ + WithCreate withLearnedType(LearnedType learnedType); + } + } + /** + * Begins update for the PeeringServicePrefix resource. + * + * @return the stage of resource update. + */ + PeeringServicePrefix.Update update(); + + /** The template for PeeringServicePrefix update. */ + interface Update + extends UpdateStages.WithPrefix, UpdateStages.WithPrefixValidationState, UpdateStages.WithLearnedType { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PeeringServicePrefix apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PeeringServicePrefix apply(Context context); + } + /** The PeeringServicePrefix update stages. */ + interface UpdateStages { + /** The stage of the PeeringServicePrefix update allowing to specify prefix. */ + interface WithPrefix { + /** + * Specifies the prefix property: Valid route prefix. + * + * @param prefix Valid route prefix. + * @return the next definition stage. + */ + Update withPrefix(String prefix); + } + /** The stage of the PeeringServicePrefix update allowing to specify prefixValidationState. */ + interface WithPrefixValidationState { + /** + * Specifies the prefixValidationState property: The prefix validation state. + * + * @param prefixValidationState The prefix validation state. + * @return the next definition stage. + */ + Update withPrefixValidationState(PrefixValidationState prefixValidationState); + } + /** The stage of the PeeringServicePrefix update allowing to specify learnedType. */ + interface WithLearnedType { + /** + * Specifies the learnedType property: The prefix learned type. + * + * @param learnedType The prefix learned type. + * @return the next definition stage. + */ + Update withLearnedType(LearnedType learnedType); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PeeringServicePrefix refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PeeringServicePrefix refresh(Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServicePrefixListResult.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServicePrefixListResult.java new file mode 100644 index 000000000000..83fef28f2763 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServicePrefixListResult.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.peering.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.fluent.models.PeeringServicePrefixInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The paginated list of [T]. */ +@Fluent +public final class PeeringServicePrefixListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringServicePrefixListResult.class); + + /* + * The list of [T]. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link to fetch the next page of [T]. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of [T]. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of [T]. + * + * @param value the value value to set. + * @return the PeeringServicePrefixListResult object itself. + */ + public PeeringServicePrefixListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to fetch the next page of [T]. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to fetch the next page of [T]. + * + * @param nextLink the nextLink value to set. + * @return the PeeringServicePrefixListResult object itself. + */ + public PeeringServicePrefixListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + 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/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServicePrefixes.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServicePrefixes.java new file mode 100644 index 000000000000..43845aa3d0b1 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServicePrefixes.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PeeringServicePrefixes. */ +public interface PeeringServicePrefixes { + /** + * Gets the peering service prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix 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 peering service prefix. + */ + PeeringServicePrefix get(String resourceGroupName, String peeringServiceName, String prefixName); + + /** + * Gets the peering service prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix 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 peering service prefix. + */ + Response getWithResponse( + String resourceGroupName, String peeringServiceName, String prefixName, Context context); + + /** + * removes the peering prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix 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 delete(String resourceGroupName, String peeringServiceName, String prefixName); + + /** + * removes the peering prefix. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service name. + * @param prefixName The prefix name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse( + String resourceGroupName, String peeringServiceName, String prefixName, Context context); + + /** + * Gets the peering service prefix. + * + * @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 peering service prefix. + */ + PeeringServicePrefix getById(String id); + + /** + * Gets the peering service prefix. + * + * @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 peering service prefix. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * removes the peering prefix. + * + * @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); + + /** + * removes the peering prefix. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new PeeringServicePrefix resource. + * + * @param name resource name. + * @return the first stage of the new PeeringServicePrefix definition. + */ + PeeringServicePrefix.DefinitionStages.Blank define(String name); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceProvider.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceProvider.java new file mode 100644 index 000000000000..18f5f250cd83 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceProvider.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.resourcemanager.peering.fluent.models.PeeringServiceProviderInner; + +/** An immutable client-side representation of PeeringServiceProvider. */ +public interface PeeringServiceProvider { + /** + * 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 serviceProviderName property: The name of the service provider. + * + * @return the serviceProviderName value. + */ + String serviceProviderName(); + + /** + * Gets the inner com.azure.resourcemanager.peering.fluent.models.PeeringServiceProviderInner object. + * + * @return the inner object. + */ + PeeringServiceProviderInner innerModel(); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceProviderListResult.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceProviderListResult.java new file mode 100644 index 000000000000..340e726eb31d --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceProviderListResult.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.peering.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.fluent.models.PeeringServiceProviderInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The paginated list of peering service providers. */ +@Fluent +public final class PeeringServiceProviderListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringServiceProviderListResult.class); + + /* + * The list of peering service providers. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link to fetch the next page of peering service providers. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of peering service providers. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of peering service providers. + * + * @param value the value value to set. + * @return the PeeringServiceProviderListResult object itself. + */ + public PeeringServiceProviderListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to fetch the next page of peering service providers. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to fetch the next page of peering service providers. + * + * @param nextLink the nextLink value to set. + * @return the PeeringServiceProviderListResult object itself. + */ + public PeeringServiceProviderListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + 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/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceProviders.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceProviders.java new file mode 100644 index 000000000000..fb4edbe09d4e --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceProviders.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.peering.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of PeeringServiceProviders. */ +public interface PeeringServiceProviders { + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @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 paginated list of peering service providers. + */ + PagedIterable list(); + + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @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 paginated list of peering service providers. + */ + PagedIterable list(Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServices.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServices.java new file mode 100644 index 000000000000..9166c4e27722 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServices.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.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 PeeringServices. */ +public interface PeeringServices { + /** + * Gets an existing peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing peering service with the specified name under the given subscription and resource group. + */ + PeeringService getByResourceGroup(String resourceGroupName, String peeringServiceName); + + /** + * Gets an existing peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing peering service with the specified name under the given subscription and resource group. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String peeringServiceName, Context context); + + /** + * Deletes an existing peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String peeringServiceName); + + /** + * Deletes an existing peering service with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String resourceGroupName, String peeringServiceName, Context context); + + /** + * Lists all of the peering services under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 paginated list of peering services. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all of the peering services under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 paginated list of peering services. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all of the peerings under the given subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peering services. + */ + PagedIterable list(); + + /** + * Lists all of the peerings under the given subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peering services. + */ + PagedIterable list(Context context); + + /** + * Gets an existing peering service with the specified name under the given subscription and resource group. + * + * @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 an existing peering service with the specified name under the given subscription and resource group. + */ + PeeringService getById(String id); + + /** + * Gets an existing peering service with the specified name under the given subscription and resource group. + * + * @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 an existing peering service with the specified name under the given subscription and resource group. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an existing peering service with the specified name under the given subscription and resource group. + * + * @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 an existing peering service with the specified name under the given subscription and resource group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new PeeringService resource. + * + * @param name resource name. + * @return the first stage of the new PeeringService definition. + */ + PeeringService.DefinitionStages.Blank define(String name); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringSku.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringSku.java new file mode 100644 index 000000000000..3265b3234dfe --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringSku.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.peering.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SKU that defines the tier and kind of the peering. */ +@Fluent +public final class PeeringSku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringSku.class); + + /* + * The name of the peering SKU. + */ + @JsonProperty(value = "name") + private Name name; + + /* + * The tier of the peering SKU. + */ + @JsonProperty(value = "tier") + private Tier tier; + + /* + * The family of the peering SKU. + */ + @JsonProperty(value = "family") + private Family family; + + /* + * The size of the peering SKU. + */ + @JsonProperty(value = "size") + private Size size; + + /** + * Get the name property: The name of the peering SKU. + * + * @return the name value. + */ + public Name name() { + return this.name; + } + + /** + * Set the name property: The name of the peering SKU. + * + * @param name the name value to set. + * @return the PeeringSku object itself. + */ + public PeeringSku withName(Name name) { + this.name = name; + return this; + } + + /** + * Get the tier property: The tier of the peering SKU. + * + * @return the tier value. + */ + public Tier tier() { + return this.tier; + } + + /** + * Set the tier property: The tier of the peering SKU. + * + * @param tier the tier value to set. + * @return the PeeringSku object itself. + */ + public PeeringSku withTier(Tier tier) { + this.tier = tier; + return this; + } + + /** + * Get the family property: The family of the peering SKU. + * + * @return the family value. + */ + public Family family() { + return this.family; + } + + /** + * Set the family property: The family of the peering SKU. + * + * @param family the family value to set. + * @return the PeeringSku object itself. + */ + public PeeringSku withFamily(Family family) { + this.family = family; + return this; + } + + /** + * Get the size property: The size of the peering SKU. + * + * @return the size value. + */ + public Size size() { + return this.size; + } + + /** + * Set the size property: The size of the peering SKU. + * + * @param size the size value to set. + * @return the PeeringSku object itself. + */ + public PeeringSku withSize(Size size) { + this.size = size; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Peerings.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Peerings.java new file mode 100644 index 000000000000..b0bee129f0a5 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Peerings.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.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 Peerings. */ +public interface Peerings { + /** + * Gets an existing peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing peering with the specified name under the given subscription and resource group. + */ + Peering getByResourceGroup(String resourceGroupName, String peeringName); + + /** + * Gets an existing peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing peering with the specified name under the given subscription and resource group. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String peeringName, Context context); + + /** + * Deletes an existing peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String peeringName); + + /** + * Deletes an existing peering with the specified name under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String resourceGroupName, String peeringName, Context context); + + /** + * Lists all of the peerings under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 paginated list of peerings. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all of the peerings under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 paginated list of peerings. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all of the peerings under the given subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peerings. + */ + PagedIterable list(); + + /** + * Lists all of the peerings under the given subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated list of peerings. + */ + PagedIterable list(Context context); + + /** + * Gets an existing peering with the specified name under the given subscription and resource group. + * + * @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 an existing peering with the specified name under the given subscription and resource group. + */ + Peering getById(String id); + + /** + * Gets an existing peering with the specified name under the given subscription and resource group. + * + * @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 an existing peering with the specified name under the given subscription and resource group. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an existing peering with the specified name under the given subscription and resource group. + * + * @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 an existing peering with the specified name under the given subscription and resource group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Peering resource. + * + * @param name resource name. + * @return the first stage of the new Peering definition. + */ + Peering.DefinitionStages.Blank define(String name); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PrefixValidationState.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PrefixValidationState.java new file mode 100644 index 000000000000..abf7b7f8cfc4 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PrefixValidationState.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.peering.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrefixValidationState. */ +public final class PrefixValidationState extends ExpandableStringEnum { + /** Static value None for PrefixValidationState. */ + public static final PrefixValidationState NONE = fromString("None"); + + /** Static value Invalid for PrefixValidationState. */ + public static final PrefixValidationState INVALID = fromString("Invalid"); + + /** Static value Verified for PrefixValidationState. */ + public static final PrefixValidationState VERIFIED = fromString("Verified"); + + /** Static value Failed for PrefixValidationState. */ + public static final PrefixValidationState FAILED = fromString("Failed"); + + /** Static value Pending for PrefixValidationState. */ + public static final PrefixValidationState PENDING = fromString("Pending"); + + /** Static value Unknown for PrefixValidationState. */ + public static final PrefixValidationState UNKNOWN = fromString("Unknown"); + + /** + * Creates or finds a PrefixValidationState from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrefixValidationState. + */ + @JsonCreator + public static PrefixValidationState fromString(String name) { + return fromString(name, PrefixValidationState.class); + } + + /** @return known PrefixValidationState values. */ + public static Collection values() { + return values(PrefixValidationState.class); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Prefixes.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Prefixes.java new file mode 100644 index 000000000000..a59b87a63096 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Prefixes.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.peering.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Prefixes. */ +public interface Prefixes { + /** + * Lists the peerings prefix in the resource group. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service 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 paginated list of [T]. + */ + PagedIterable listByPeeringService(String resourceGroupName, String peeringServiceName); + + /** + * Lists the peerings prefix in the resource group. + * + * @param resourceGroupName The resource group name. + * @param peeringServiceName The peering service 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 paginated list of [T]. + */ + PagedIterable listByPeeringService( + String resourceGroupName, String peeringServiceName, Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ProvisioningState.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ProvisioningState.java new file mode 100644 index 000000000000..0d98df9ca1b3 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ProvisioningState.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningState. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Updating for ProvisioningState. */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** @return known ProvisioningState values. */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ResourceProviders.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ResourceProviders.java new file mode 100644 index 000000000000..dfe3423e1217 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ResourceProviders.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.peering.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ResourceProviders. */ +public interface ResourceProviders { + /** + * Checks if the peering service provider is present within 1000 miles of customer's location. + * + * @param checkServiceProviderAvailabilityInput The CheckServiceProviderAvailabilityInput indicating customer + * location and service provider. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Enum0 checkServiceProviderAvailability(CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput); + + /** + * Checks if the peering service provider is present within 1000 miles of customer's location. + * + * @param checkServiceProviderAvailabilityInput The CheckServiceProviderAvailabilityInput indicating customer + * location and service provider. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response checkServiceProviderAvailabilityWithResponse( + CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput, Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ResourceTags.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ResourceTags.java new file mode 100644 index 000000000000..58861fff4f6a --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ResourceTags.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The resource tags. */ +@Fluent +public final class ResourceTags { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceTags.class); + + /* + * Gets or sets the tags, a dictionary of descriptors arm object + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the tags property: Gets or sets the tags, a dictionary of descriptors arm object. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Gets or sets the tags, a dictionary of descriptors arm object. + * + * @param tags the tags value to set. + * @return the ResourceTags object itself. + */ + public ResourceTags withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/SessionAddressProvider.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/SessionAddressProvider.java new file mode 100644 index 000000000000..8fec6c8a037f --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/SessionAddressProvider.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.peering.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SessionAddressProvider. */ +public final class SessionAddressProvider extends ExpandableStringEnum { + /** Static value Microsoft for SessionAddressProvider. */ + public static final SessionAddressProvider MICROSOFT = fromString("Microsoft"); + + /** Static value Peer for SessionAddressProvider. */ + public static final SessionAddressProvider PEER = fromString("Peer"); + + /** + * Creates or finds a SessionAddressProvider from its string representation. + * + * @param name a name to look for. + * @return the corresponding SessionAddressProvider. + */ + @JsonCreator + public static SessionAddressProvider fromString(String name) { + return fromString(name, SessionAddressProvider.class); + } + + /** @return known SessionAddressProvider values. */ + public static Collection values() { + return values(SessionAddressProvider.class); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/SessionStateV4.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/SessionStateV4.java new file mode 100644 index 000000000000..36c40fca4442 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/SessionStateV4.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SessionStateV4. */ +public final class SessionStateV4 extends ExpandableStringEnum { + /** Static value None for SessionStateV4. */ + public static final SessionStateV4 NONE = fromString("None"); + + /** Static value Idle for SessionStateV4. */ + public static final SessionStateV4 IDLE = fromString("Idle"); + + /** Static value Connect for SessionStateV4. */ + public static final SessionStateV4 CONNECT = fromString("Connect"); + + /** Static value Active for SessionStateV4. */ + public static final SessionStateV4 ACTIVE = fromString("Active"); + + /** Static value OpenSent for SessionStateV4. */ + public static final SessionStateV4 OPEN_SENT = fromString("OpenSent"); + + /** Static value OpenConfirm for SessionStateV4. */ + public static final SessionStateV4 OPEN_CONFIRM = fromString("OpenConfirm"); + + /** Static value OpenReceived for SessionStateV4. */ + public static final SessionStateV4 OPEN_RECEIVED = fromString("OpenReceived"); + + /** Static value Established for SessionStateV4. */ + public static final SessionStateV4 ESTABLISHED = fromString("Established"); + + /** Static value PendingAdd for SessionStateV4. */ + public static final SessionStateV4 PENDING_ADD = fromString("PendingAdd"); + + /** Static value PendingUpdate for SessionStateV4. */ + public static final SessionStateV4 PENDING_UPDATE = fromString("PendingUpdate"); + + /** Static value PendingRemove for SessionStateV4. */ + public static final SessionStateV4 PENDING_REMOVE = fromString("PendingRemove"); + + /** + * Creates or finds a SessionStateV4 from its string representation. + * + * @param name a name to look for. + * @return the corresponding SessionStateV4. + */ + @JsonCreator + public static SessionStateV4 fromString(String name) { + return fromString(name, SessionStateV4.class); + } + + /** @return known SessionStateV4 values. */ + public static Collection values() { + return values(SessionStateV4.class); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/SessionStateV6.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/SessionStateV6.java new file mode 100644 index 000000000000..0c76eb25a21f --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/SessionStateV6.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SessionStateV6. */ +public final class SessionStateV6 extends ExpandableStringEnum { + /** Static value None for SessionStateV6. */ + public static final SessionStateV6 NONE = fromString("None"); + + /** Static value Idle for SessionStateV6. */ + public static final SessionStateV6 IDLE = fromString("Idle"); + + /** Static value Connect for SessionStateV6. */ + public static final SessionStateV6 CONNECT = fromString("Connect"); + + /** Static value Active for SessionStateV6. */ + public static final SessionStateV6 ACTIVE = fromString("Active"); + + /** Static value OpenSent for SessionStateV6. */ + public static final SessionStateV6 OPEN_SENT = fromString("OpenSent"); + + /** Static value OpenConfirm for SessionStateV6. */ + public static final SessionStateV6 OPEN_CONFIRM = fromString("OpenConfirm"); + + /** Static value OpenReceived for SessionStateV6. */ + public static final SessionStateV6 OPEN_RECEIVED = fromString("OpenReceived"); + + /** Static value Established for SessionStateV6. */ + public static final SessionStateV6 ESTABLISHED = fromString("Established"); + + /** Static value PendingAdd for SessionStateV6. */ + public static final SessionStateV6 PENDING_ADD = fromString("PendingAdd"); + + /** Static value PendingUpdate for SessionStateV6. */ + public static final SessionStateV6 PENDING_UPDATE = fromString("PendingUpdate"); + + /** Static value PendingRemove for SessionStateV6. */ + public static final SessionStateV6 PENDING_REMOVE = fromString("PendingRemove"); + + /** + * Creates or finds a SessionStateV6 from its string representation. + * + * @param name a name to look for. + * @return the corresponding SessionStateV6. + */ + @JsonCreator + public static SessionStateV6 fromString(String name) { + return fromString(name, SessionStateV6.class); + } + + /** @return known SessionStateV6 values. */ + public static Collection values() { + return values(SessionStateV6.class); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Size.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Size.java new file mode 100644 index 000000000000..c15388e1caf5 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Size.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.peering.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Size. */ +public final class Size extends ExpandableStringEnum { + /** Static value Free for Size. */ + public static final Size FREE = fromString("Free"); + + /** Static value Metered for Size. */ + public static final Size METERED = fromString("Metered"); + + /** Static value Unlimited for Size. */ + public static final Size UNLIMITED = fromString("Unlimited"); + + /** + * Creates or finds a Size from its string representation. + * + * @param name a name to look for. + * @return the corresponding Size. + */ + @JsonCreator + public static Size fromString(String name) { + return fromString(name, Size.class); + } + + /** @return known Size values. */ + public static Collection values() { + return values(Size.class); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Tier.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Tier.java new file mode 100644 index 000000000000..aa1399cd136d --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Tier.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.peering.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Tier. */ +public final class Tier extends ExpandableStringEnum { + /** Static value Basic for Tier. */ + public static final Tier BASIC = fromString("Basic"); + + /** Static value Premium for Tier. */ + public static final Tier PREMIUM = fromString("Premium"); + + /** + * Creates or finds a Tier from its string representation. + * + * @param name a name to look for. + * @return the corresponding Tier. + */ + @JsonCreator + public static Tier fromString(String name) { + return fromString(name, Tier.class); + } + + /** @return known Tier values. */ + public static Collection values() { + return values(Tier.class); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ValidationState.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ValidationState.java new file mode 100644 index 000000000000..a3e98a33fa9c --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ValidationState.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ValidationState. */ +public final class ValidationState extends ExpandableStringEnum { + /** Static value None for ValidationState. */ + public static final ValidationState NONE = fromString("None"); + + /** Static value Pending for ValidationState. */ + public static final ValidationState PENDING = fromString("Pending"); + + /** Static value Approved for ValidationState. */ + public static final ValidationState APPROVED = fromString("Approved"); + + /** Static value Failed for ValidationState. */ + public static final ValidationState FAILED = fromString("Failed"); + + /** + * Creates or finds a ValidationState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ValidationState. + */ + @JsonCreator + public static ValidationState fromString(String name) { + return fromString(name, ValidationState.class); + } + + /** @return known ValidationState values. */ + public static Collection values() { + return values(ValidationState.class); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/package-info.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/package-info.java new file mode 100644 index 000000000000..4a30d6a8e48a --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/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 PeeringManagementClient. Peering Client. */ +package com.azure.resourcemanager.peering.models; diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/package-info.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/package-info.java new file mode 100644 index 000000000000..22e5d70be857 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/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 PeeringManagementClient. Peering Client. */ +package com.azure.resourcemanager.peering; diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/module-info.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/module-info.java new file mode 100644 index 000000000000..afd2a4614c40 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/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.peering { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.peering; + exports com.azure.resourcemanager.peering.fluent; + exports com.azure.resourcemanager.peering.fluent.models; + exports com.azure.resourcemanager.peering.models; + + opens com.azure.resourcemanager.peering.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.peering.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/peering/ci.yml b/sdk/peering/ci.yml new file mode 100644 index 000000000000..ce25c3dfc980 --- /dev/null +++ b/sdk/peering/ci.yml @@ -0,0 +1,33 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - main + - hotfix/* + - release/* + paths: + include: + - sdk/peering/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/peering/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: peering + Artifacts: + - name: azure-resourcemanager-peering + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerpeering diff --git a/sdk/peering/pom.xml b/sdk/peering/pom.xml new file mode 100644 index 000000000000..f4404590408b --- /dev/null +++ b/sdk/peering/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-peering-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-peering + + + +