diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index c5a8e7499fa2..a3b5eb606fbd 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -208,6 +208,7 @@ com.azure.resourcemanager:azure-resourcemanager-storagecache;1.0.0-beta.1;1.0.0- com.azure.resourcemanager:azure-resourcemanager-redisenterprise;1.0.0-beta.2;1.0.0-beta.3 com.azure.resourcemanager:azure-resourcemanager-hybridkubernetes;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-iothub;1.0.0-beta.1;1.0.0-beta.2 +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 c45b7dcd31ad..31abcf4d3a96 100644 --- a/pom.xml +++ b/pom.xml @@ -604,6 +604,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..22f05d094e3d --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-03-03) + +- Azure Resource Manager Peering client library for Java. This package contains Microsoft Azure SDK for Peering Management SDK. Peering Client. Package tag package-2021-01-01. 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..00d3a5d8a383 --- /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-2021-01-01. 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..69914d844c37 --- /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. Peering Client. Package tag package-2021-01-01. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt + 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.13.0 + + + com.azure + azure-core-management + 1.1.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..21f0b4357be5 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/PeeringManager.java @@ -0,0 +1,385 @@ +// 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.CdnPeeringPrefixesImpl; +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.PeeringServiceCountriesImpl; +import com.azure.resourcemanager.peering.implementation.PeeringServiceLocationsImpl; +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.ReceivedRoutesImpl; +import com.azure.resourcemanager.peering.implementation.RegisteredAsnsImpl; +import com.azure.resourcemanager.peering.implementation.RegisteredPrefixesImpl; +import com.azure.resourcemanager.peering.implementation.ResourceProvidersImpl; +import com.azure.resourcemanager.peering.models.CdnPeeringPrefixes; +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.PeeringServiceCountries; +import com.azure.resourcemanager.peering.models.PeeringServiceLocations; +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.ReceivedRoutes; +import com.azure.resourcemanager.peering.models.RegisteredAsns; +import com.azure.resourcemanager.peering.models.RegisteredPrefixes; +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 CdnPeeringPrefixes cdnPeeringPrefixes; + + private ResourceProviders resourceProviders; + + private LegacyPeerings legacyPeerings; + + private Operations operations; + + private PeerAsns peerAsns; + + private PeeringLocations peeringLocations; + + private RegisteredAsns registeredAsns; + + private RegisteredPrefixes registeredPrefixes; + + private Peerings peerings; + + private ReceivedRoutes receivedRoutes; + + private PeeringServiceCountries peeringServiceCountries; + + private PeeringServiceLocations peeringServiceLocations; + + 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")); + 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 CdnPeeringPrefixes. */ + public CdnPeeringPrefixes cdnPeeringPrefixes() { + if (this.cdnPeeringPrefixes == null) { + this.cdnPeeringPrefixes = new CdnPeeringPrefixesImpl(clientObject.getCdnPeeringPrefixes(), this); + } + return cdnPeeringPrefixes; + } + + /** @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 RegisteredAsns. */ + public RegisteredAsns registeredAsns() { + if (this.registeredAsns == null) { + this.registeredAsns = new RegisteredAsnsImpl(clientObject.getRegisteredAsns(), this); + } + return registeredAsns; + } + + /** @return Resource collection API of RegisteredPrefixes. */ + public RegisteredPrefixes registeredPrefixes() { + if (this.registeredPrefixes == null) { + this.registeredPrefixes = new RegisteredPrefixesImpl(clientObject.getRegisteredPrefixes(), this); + } + return registeredPrefixes; + } + + /** @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 ReceivedRoutes. */ + public ReceivedRoutes receivedRoutes() { + if (this.receivedRoutes == null) { + this.receivedRoutes = new ReceivedRoutesImpl(clientObject.getReceivedRoutes(), this); + } + return receivedRoutes; + } + + /** @return Resource collection API of PeeringServiceCountries. */ + public PeeringServiceCountries peeringServiceCountries() { + if (this.peeringServiceCountries == null) { + this.peeringServiceCountries = + new PeeringServiceCountriesImpl(clientObject.getPeeringServiceCountries(), this); + } + return peeringServiceCountries; + } + + /** @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 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/CdnPeeringPrefixesClient.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/CdnPeeringPrefixesClient.java new file mode 100644 index 000000000000..50ed5b9c39aa --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/CdnPeeringPrefixesClient.java @@ -0,0 +1,39 @@ +// 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.CdnPeeringPrefixInner; + +/** An instance of this class provides access to all the operations defined in CdnPeeringPrefixesClient. */ +public interface CdnPeeringPrefixesClient { + /** + * Lists all of the advertised prefixes for the specified peering location. + * + * @param peeringLocation The peering location. + * @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 CDN peering prefixes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String peeringLocation); + + /** + * Lists all of the advertised prefixes for the specified peering location. + * + * @param peeringLocation The peering location. + * @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 CDN peering prefixes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String peeringLocation, Context context); +} 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..c8cba0bec65e --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/LegacyPeeringsClient.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.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 asn The ASN number associated with a legacy 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, Integer asn, 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..70c527cbb0ea --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringManagementClient.java @@ -0,0 +1,151 @@ +// 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 CdnPeeringPrefixesClient object to access its operations. + * + * @return the CdnPeeringPrefixesClient object. + */ + CdnPeeringPrefixesClient getCdnPeeringPrefixes(); + + /** + * 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 RegisteredAsnsClient object to access its operations. + * + * @return the RegisteredAsnsClient object. + */ + RegisteredAsnsClient getRegisteredAsns(); + + /** + * Gets the RegisteredPrefixesClient object to access its operations. + * + * @return the RegisteredPrefixesClient object. + */ + RegisteredPrefixesClient getRegisteredPrefixes(); + + /** + * Gets the PeeringsClient object to access its operations. + * + * @return the PeeringsClient object. + */ + PeeringsClient getPeerings(); + + /** + * Gets the ReceivedRoutesClient object to access its operations. + * + * @return the ReceivedRoutesClient object. + */ + ReceivedRoutesClient getReceivedRoutes(); + + /** + * Gets the PeeringServiceCountriesClient object to access its operations. + * + * @return the PeeringServiceCountriesClient object. + */ + PeeringServiceCountriesClient getPeeringServiceCountries(); + + /** + * Gets the PeeringServiceLocationsClient object to access its operations. + * + * @return the PeeringServiceLocationsClient object. + */ + PeeringServiceLocationsClient getPeeringServiceLocations(); + + /** + * 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/PeeringServiceCountriesClient.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringServiceCountriesClient.java new file mode 100644 index 000000000000..9e27c5b6e5c4 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringServiceCountriesClient.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.management.Resource; +import com.azure.core.util.Context; + +/** An instance of this class provides access to all the operations defined in PeeringServiceCountriesClient. */ +public interface PeeringServiceCountriesClient { + /** + * Lists all of the available countries for peering service. + * + * @throws com.azure.core.management.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 countries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available countries for 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 paginated list of peering service countries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} 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..69f837fdd14c --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PeeringServiceLocationsClient.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.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 locations for peering service. + * + * @throws com.azure.core.management.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 locations for peering service. + * + * @param country The country of interest, in which the locations are to be present. + * @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(String country, 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..ab6755d21576 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/PrefixesClient.java @@ -0,0 +1,148 @@ +// 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.PeeringServicePrefixInner; + +/** An instance of this class provides access to all the operations defined in PrefixesClient. */ +public interface PrefixesClient { + /** + * Gets an existing prefix with the specified name under the given subscription, resource group and peering service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @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 prefix with the specified name under the given subscription, resource group and peering + * service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PeeringServicePrefixInner get(String resourceGroupName, String peeringServiceName, String prefixName); + + /** + * Gets an existing prefix with the specified name under the given subscription, resource group and peering service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @param expand The properties to be expanded. + * @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 prefix with the specified name under the given subscription, resource group and peering + * service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String peeringServiceName, String prefixName, String expand, Context context); + + /** + * Creates a new prefix with the specified name under the given subscription, resource group and peering service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @param peeringServicePrefix The properties needed to create a prefix. + * @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 a new prefix with the specified name under the given subscription, resource group and peering service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @param peeringServicePrefix The properties needed to create a prefix. + * @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); + + /** + * Deletes an existing prefix with the specified name under the given subscription, resource group and peering + * service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @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); + + /** + * Deletes an existing prefix with the specified name under the given subscription, resource group and peering + * service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @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); + + /** + * Lists all prefixes under the given subscription, resource group and peering service. + * + * @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. + * @return the paginated list of peering service prefixes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByPeeringService(String resourceGroupName, String peeringServiceName); + + /** + * Lists all prefixes under the given subscription, resource group and peering service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param expand The properties to be expanded. + * @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 prefixes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByPeeringService( + String resourceGroupName, String peeringServiceName, String expand, Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/ReceivedRoutesClient.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/ReceivedRoutesClient.java new file mode 100644 index 000000000000..028c632042c3 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/ReceivedRoutesClient.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.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.PeeringReceivedRouteInner; + +/** An instance of this class provides access to all the operations defined in ReceivedRoutesClient. */ +public interface ReceivedRoutesClient { + /** + * Lists the prefixes received over the specified peering 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 the paginated list of received routes for the peering. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByPeering(String resourceGroupName, String peeringName); + + /** + * Lists the prefixes received over the specified peering under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param prefix The optional prefix that can be used to filter the routes. + * @param asPath The optional AS path that can be used to filter the routes. + * @param originAsValidationState The optional origin AS validation state that can be used to filter the routes. + * @param rpkiValidationState The optional RPKI validation state that can be used to filter the routes. + * @param skipToken The optional page continuation token that is used in the event of paginated result. + * @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 received routes for the peering. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByPeering( + String resourceGroupName, + String peeringName, + String prefix, + String asPath, + String originAsValidationState, + String rpkiValidationState, + String skipToken, + Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/RegisteredAsnsClient.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/RegisteredAsnsClient.java new file mode 100644 index 000000000000..36c7448d7392 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/RegisteredAsnsClient.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.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.PeeringRegisteredAsnInner; + +/** An instance of this class provides access to all the operations defined in RegisteredAsnsClient. */ +public interface RegisteredAsnsClient { + /** + * Gets an existing registered ASN with the specified name under the given subscription, resource group and peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the registered 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 an existing registered ASN with the specified name under the given subscription, resource group and + * peering. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PeeringRegisteredAsnInner get(String resourceGroupName, String peeringName, String registeredAsnName); + + /** + * Gets an existing registered ASN with the specified name under the given subscription, resource group and peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the registered 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 an existing registered ASN with the specified name under the given subscription, resource group and + * peering. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String peeringName, String registeredAsnName, Context context); + + /** + * Creates a new registered ASN with the specified name under the given subscription, resource group and peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the ASN. + * @param registeredAsn The properties needed to create a registered 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 customer's ASN that is registered by the peering service provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PeeringRegisteredAsnInner createOrUpdate( + String resourceGroupName, + String peeringName, + String registeredAsnName, + PeeringRegisteredAsnInner registeredAsn); + + /** + * Creates a new registered ASN with the specified name under the given subscription, resource group and peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the ASN. + * @param registeredAsn The properties needed to create a registered 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 customer's ASN that is registered by the peering service provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String peeringName, + String registeredAsnName, + PeeringRegisteredAsnInner registeredAsn, + Context context); + + /** + * Deletes an existing registered ASN with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the registered 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String peeringName, String registeredAsnName); + + /** + * Deletes an existing registered ASN with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the registered 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String peeringName, String registeredAsnName, Context context); + + /** + * Lists all registered ASNs under the given subscription, resource group and peering. + * + * @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 the paginated list of peering registered ASNs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByPeering(String resourceGroupName, String peeringName); + + /** + * Lists all registered ASNs under the given subscription, resource group and peering. + * + * @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 paginated list of peering registered ASNs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByPeering( + String resourceGroupName, String peeringName, Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/RegisteredPrefixesClient.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/RegisteredPrefixesClient.java new file mode 100644 index 000000000000..fb587e31173e --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/RegisteredPrefixesClient.java @@ -0,0 +1,148 @@ +// 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.PeeringRegisteredPrefixInner; + +/** An instance of this class provides access to all the operations defined in RegisteredPrefixesClient. */ +public interface RegisteredPrefixesClient { + /** + * Gets an existing registered prefix with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @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 registered prefix with the specified name under the given subscription, resource group and + * peering. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PeeringRegisteredPrefixInner get(String resourceGroupName, String peeringName, String registeredPrefixName); + + /** + * Gets an existing registered prefix with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @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 registered prefix with the specified name under the given subscription, resource group and + * peering. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String peeringName, String registeredPrefixName, Context context); + + /** + * Creates a new registered prefix with the specified name under the given subscription, resource group and peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @param registeredPrefix The properties needed to create a registered prefix. + * @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 customer's prefix that is registered by the peering service provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PeeringRegisteredPrefixInner createOrUpdate( + String resourceGroupName, + String peeringName, + String registeredPrefixName, + PeeringRegisteredPrefixInner registeredPrefix); + + /** + * Creates a new registered prefix with the specified name under the given subscription, resource group and peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @param registeredPrefix The properties needed to create a registered prefix. + * @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 customer's prefix that is registered by the peering service provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String peeringName, + String registeredPrefixName, + PeeringRegisteredPrefixInner registeredPrefix, + Context context); + + /** + * Deletes an existing registered prefix with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @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, String registeredPrefixName); + + /** + * Deletes an existing registered prefix with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @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, String registeredPrefixName, Context context); + + /** + * Lists all registered prefixes under the given subscription, resource group and peering. + * + * @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 the paginated list of peering registered prefixes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByPeering(String resourceGroupName, String peeringName); + + /** + * Lists all registered prefixes under the given subscription, resource group and peering. + * + * @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 paginated list of peering registered prefixes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByPeering( + String resourceGroupName, String peeringName, 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/CdnPeeringPrefixInner.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/CdnPeeringPrefixInner.java new file mode 100644 index 000000000000..aae2b0bb7dc9 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/CdnPeeringPrefixInner.java @@ -0,0 +1,102 @@ +// 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.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; + +/** The CDN peering prefix. */ +@JsonFlatten +@Immutable +public class CdnPeeringPrefixInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CdnPeeringPrefixInner.class); + + /* + * The prefix. + */ + @JsonProperty(value = "properties.prefix", access = JsonProperty.Access.WRITE_ONLY) + private String prefix; + + /* + * The Azure region. + */ + @JsonProperty(value = "properties.azureRegion", access = JsonProperty.Access.WRITE_ONLY) + private String azureRegion; + + /* + * The Azure service. + */ + @JsonProperty(value = "properties.azureService", access = JsonProperty.Access.WRITE_ONLY) + private String azureService; + + /* + * The flag that indicates whether or not this is the primary region. + */ + @JsonProperty(value = "properties.isPrimaryRegion", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isPrimaryRegion; + + /* + * The BGP Community + */ + @JsonProperty(value = "properties.bgpCommunity", access = JsonProperty.Access.WRITE_ONLY) + private String bgpCommunity; + + /** + * Get the prefix property: The prefix. + * + * @return the prefix value. + */ + public String prefix() { + return this.prefix; + } + + /** + * Get the azureRegion property: The Azure region. + * + * @return the azureRegion value. + */ + public String azureRegion() { + return this.azureRegion; + } + + /** + * Get the azureService property: The Azure service. + * + * @return the azureService value. + */ + public String azureService() { + return this.azureService; + } + + /** + * Get the isPrimaryRegion property: The flag that indicates whether or not this is the primary region. + * + * @return the isPrimaryRegion value. + */ + public Boolean isPrimaryRegion() { + return this.isPrimaryRegion; + } + + /** + * Get the bgpCommunity property: The BGP Community. + * + * @return the bgpCommunity value. + */ + public String bgpCommunity() { + return this.bgpCommunity; + } + + /** + * 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/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..562bcd708fd0 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeerAsnInner.java @@ -0,0 +1,152 @@ +// 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.ContactDetail; +import com.azure.resourcemanager.peering.models.ValidationState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** 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 details of the peer. + */ + @JsonProperty(value = "properties.peerContactDetail") + private List peerContactDetail; + + /* + * 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; + + /* + * The error message for the validation state + */ + @JsonProperty(value = "properties.errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /** + * 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 peerContactDetail property: The contact details of the peer. + * + * @return the peerContactDetail value. + */ + public List peerContactDetail() { + return this.peerContactDetail; + } + + /** + * Set the peerContactDetail property: The contact details of the peer. + * + * @param peerContactDetail the peerContactDetail value to set. + * @return the PeerAsnInner object itself. + */ + public PeerAsnInner withPeerContactDetail(List peerContactDetail) { + this.peerContactDetail = peerContactDetail; + 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; + } + + /** + * Get the errorMessage property: The error message for the validation state. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (peerContactDetail() != null) { + peerContactDetail().forEach(e -> e.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/PeeringReceivedRouteInner.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringReceivedRouteInner.java new file mode 100644 index 000000000000..ce5d8d729f52 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringReceivedRouteInner.java @@ -0,0 +1,133 @@ +// 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.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties that define a received route. */ +@Immutable +public final class PeeringReceivedRouteInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringReceivedRouteInner.class); + + /* + * The prefix. + */ + @JsonProperty(value = "prefix", access = JsonProperty.Access.WRITE_ONLY) + private String prefix; + + /* + * The next hop for the prefix. + */ + @JsonProperty(value = "nextHop", access = JsonProperty.Access.WRITE_ONLY) + private String nextHop; + + /* + * The AS path for the prefix. + */ + @JsonProperty(value = "asPath", access = JsonProperty.Access.WRITE_ONLY) + private String asPath; + + /* + * The origin AS change information for the prefix. + */ + @JsonProperty(value = "originAsValidationState", access = JsonProperty.Access.WRITE_ONLY) + private String originAsValidationState; + + /* + * The RPKI validation state for the prefix and origin AS that's listed in + * the AS path. + */ + @JsonProperty(value = "rpkiValidationState", access = JsonProperty.Access.WRITE_ONLY) + private String rpkiValidationState; + + /* + * The authority which holds the Route Origin Authorization record for the + * prefix, if any. + */ + @JsonProperty(value = "trustAnchor", access = JsonProperty.Access.WRITE_ONLY) + private String trustAnchor; + + /* + * The received timestamp associated with the prefix. + */ + @JsonProperty(value = "receivedTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private String receivedTimestamp; + + /** + * Get the prefix property: The prefix. + * + * @return the prefix value. + */ + public String prefix() { + return this.prefix; + } + + /** + * Get the nextHop property: The next hop for the prefix. + * + * @return the nextHop value. + */ + public String nextHop() { + return this.nextHop; + } + + /** + * Get the asPath property: The AS path for the prefix. + * + * @return the asPath value. + */ + public String asPath() { + return this.asPath; + } + + /** + * Get the originAsValidationState property: The origin AS change information for the prefix. + * + * @return the originAsValidationState value. + */ + public String originAsValidationState() { + return this.originAsValidationState; + } + + /** + * Get the rpkiValidationState property: The RPKI validation state for the prefix and origin AS that's listed in the + * AS path. + * + * @return the rpkiValidationState value. + */ + public String rpkiValidationState() { + return this.rpkiValidationState; + } + + /** + * Get the trustAnchor property: The authority which holds the Route Origin Authorization record for the prefix, if + * any. + * + * @return the trustAnchor value. + */ + public String trustAnchor() { + return this.trustAnchor; + } + + /** + * Get the receivedTimestamp property: The received timestamp associated with the prefix. + * + * @return the receivedTimestamp value. + */ + public String receivedTimestamp() { + return this.receivedTimestamp; + } + + /** + * 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/PeeringRegisteredAsnInner.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringRegisteredAsnInner.java new file mode 100644 index 000000000000..5c842bd1c148 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringRegisteredAsnInner.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.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; + +/** The customer's ASN that is registered by the peering service provider. */ +@JsonFlatten +@Fluent +public class PeeringRegisteredAsnInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringRegisteredAsnInner.class); + + /* + * The customer's ASN from which traffic originates. + */ + @JsonProperty(value = "properties.asn") + private Integer asn; + + /* + * The peering service prefix key that is to be shared with the customer. + */ + @JsonProperty(value = "properties.peeringServicePrefixKey", access = JsonProperty.Access.WRITE_ONLY) + private String peeringServicePrefixKey; + + /* + * The provisioning state of the resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the asn property: The customer's ASN from which traffic originates. + * + * @return the asn value. + */ + public Integer asn() { + return this.asn; + } + + /** + * Set the asn property: The customer's ASN from which traffic originates. + * + * @param asn the asn value to set. + * @return the PeeringRegisteredAsnInner object itself. + */ + public PeeringRegisteredAsnInner withAsn(Integer asn) { + this.asn = asn; + return this; + } + + /** + * Get the peeringServicePrefixKey property: The peering service prefix key that is to be shared with the customer. + * + * @return the peeringServicePrefixKey value. + */ + public String peeringServicePrefixKey() { + return this.peeringServicePrefixKey; + } + + /** + * 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/PeeringRegisteredPrefixInner.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringRegisteredPrefixInner.java new file mode 100644 index 000000000000..0be2d0ffa58c --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringRegisteredPrefixInner.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.PrefixValidationState; +import com.azure.resourcemanager.peering.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The customer's prefix that is registered by the peering service provider. */ +@JsonFlatten +@Fluent +public class PeeringRegisteredPrefixInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringRegisteredPrefixInner.class); + + /* + * The customer's prefix from which traffic originates. + */ + @JsonProperty(value = "properties.prefix") + private String prefix; + + /* + * The prefix validation state. + */ + @JsonProperty(value = "properties.prefixValidationState", access = JsonProperty.Access.WRITE_ONLY) + private PrefixValidationState prefixValidationState; + + /* + * The peering service prefix key that is to be shared with the customer. + */ + @JsonProperty(value = "properties.peeringServicePrefixKey", access = JsonProperty.Access.WRITE_ONLY) + private String peeringServicePrefixKey; + + /* + * The error message associated with the validation state, if any. + */ + @JsonProperty(value = "properties.errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /* + * The provisioning state of the resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the prefix property: The customer's prefix from which traffic originates. + * + * @return the prefix value. + */ + public String prefix() { + return this.prefix; + } + + /** + * Set the prefix property: The customer's prefix from which traffic originates. + * + * @param prefix the prefix value to set. + * @return the PeeringRegisteredPrefixInner object itself. + */ + public PeeringRegisteredPrefixInner 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; + } + + /** + * Get the peeringServicePrefixKey property: The peering service prefix key that is to be shared with the customer. + * + * @return the peeringServicePrefixKey value. + */ + public String peeringServicePrefixKey() { + return this.peeringServicePrefixKey; + } + + /** + * Get the errorMessage property: The error message associated with the validation state, if any. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * 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/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..749f22d16f86 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringServiceInner.java @@ -0,0 +1,241 @@ +// 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.PeeringServiceSku; +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 SKU that defines the type of the peering service. + */ + @JsonProperty(value = "sku") + private PeeringServiceSku sku; + + /* + * The location of the resource. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /* + * The resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * The location (state/province) of the customer. + */ + @JsonProperty(value = "properties.peeringServiceLocation") + private String peeringServiceLocation; + + /* + * The name of the service provider. + */ + @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; + + /* + * The primary peering (Microsoft/service provider) location to be used for + * customer traffic. + */ + @JsonProperty(value = "properties.providerPrimaryPeeringLocation") + private String providerPrimaryPeeringLocation; + + /* + * The backup peering (Microsoft/service provider) location to be used for + * customer traffic. + */ + @JsonProperty(value = "properties.providerBackupPeeringLocation") + private String providerBackupPeeringLocation; + + /** + * Get the sku property: The SKU that defines the type of the peering service. + * + * @return the sku value. + */ + public PeeringServiceSku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU that defines the type of the peering service. + * + * @param sku the sku value to set. + * @return the PeeringServiceInner object itself. + */ + public PeeringServiceInner withSku(PeeringServiceSku sku) { + this.sku = sku; + 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 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 location (state/province) of the customer. + * + * @return the peeringServiceLocation value. + */ + public String peeringServiceLocation() { + return this.peeringServiceLocation; + } + + /** + * Set the peeringServiceLocation property: The location (state/province) 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 name of the service provider. + * + * @return the peeringServiceProvider value. + */ + public String peeringServiceProvider() { + return this.peeringServiceProvider; + } + + /** + * Set the peeringServiceProvider property: The name of the service provider. + * + * @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; + } + + /** + * Get the providerPrimaryPeeringLocation property: The primary peering (Microsoft/service provider) location to be + * used for customer traffic. + * + * @return the providerPrimaryPeeringLocation value. + */ + public String providerPrimaryPeeringLocation() { + return this.providerPrimaryPeeringLocation; + } + + /** + * Set the providerPrimaryPeeringLocation property: The primary peering (Microsoft/service provider) location to be + * used for customer traffic. + * + * @param providerPrimaryPeeringLocation the providerPrimaryPeeringLocation value to set. + * @return the PeeringServiceInner object itself. + */ + public PeeringServiceInner withProviderPrimaryPeeringLocation(String providerPrimaryPeeringLocation) { + this.providerPrimaryPeeringLocation = providerPrimaryPeeringLocation; + return this; + } + + /** + * Get the providerBackupPeeringLocation property: The backup peering (Microsoft/service provider) location to be + * used for customer traffic. + * + * @return the providerBackupPeeringLocation value. + */ + public String providerBackupPeeringLocation() { + return this.providerBackupPeeringLocation; + } + + /** + * Set the providerBackupPeeringLocation property: The backup peering (Microsoft/service provider) location to be + * used for customer traffic. + * + * @param providerBackupPeeringLocation the providerBackupPeeringLocation value to set. + * @return the PeeringServiceInner object itself. + */ + public PeeringServiceInner withProviderBackupPeeringLocation(String providerBackupPeeringLocation) { + this.providerBackupPeeringLocation = providerBackupPeeringLocation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().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..f8a70650d7e3 --- /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; + +/** The peering service 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..841e9636f4db --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringServicePrefixInner.java @@ -0,0 +1,162 @@ +// 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.PeeringServicePrefixEvent; +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; +import java.util.List; + +/** The peering service prefix class. */ +@JsonFlatten +@Fluent +public class PeeringServicePrefixInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringServicePrefixInner.class); + + /* + * The prefix from which your traffic originates. + */ + @JsonProperty(value = "properties.prefix") + private String prefix; + + /* + * The prefix validation state + */ + @JsonProperty(value = "properties.prefixValidationState", access = JsonProperty.Access.WRITE_ONLY) + private PrefixValidationState prefixValidationState; + + /* + * The prefix learned type + */ + @JsonProperty(value = "properties.learnedType", access = JsonProperty.Access.WRITE_ONLY) + private LearnedType learnedType; + + /* + * The error message for validation state + */ + @JsonProperty(value = "properties.errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /* + * The list of events for peering service prefix + */ + @JsonProperty(value = "properties.events", access = JsonProperty.Access.WRITE_ONLY) + private List events; + + /* + * The peering service prefix key + */ + @JsonProperty(value = "properties.peeringServicePrefixKey") + private String peeringServicePrefixKey; + + /* + * The provisioning state of the resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the prefix property: The prefix from which your traffic originates. + * + * @return the prefix value. + */ + public String prefix() { + return this.prefix; + } + + /** + * Set the prefix property: The prefix from which your traffic originates. + * + * @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; + } + + /** + * Get the learnedType property: The prefix learned type. + * + * @return the learnedType value. + */ + public LearnedType learnedType() { + return this.learnedType; + } + + /** + * Get the errorMessage property: The error message for validation state. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the events property: The list of events for peering service prefix. + * + * @return the events value. + */ + public List events() { + return this.events; + } + + /** + * Get the peeringServicePrefixKey property: The peering service prefix key. + * + * @return the peeringServicePrefixKey value. + */ + public String peeringServicePrefixKey() { + return this.peeringServicePrefixKey; + } + + /** + * Set the peeringServicePrefixKey property: The peering service prefix key. + * + * @param peeringServicePrefixKey the peeringServicePrefixKey value to set. + * @return the PeeringServicePrefixInner object itself. + */ + public PeeringServicePrefixInner withPeeringServicePrefixKey(String peeringServicePrefixKey) { + this.peeringServicePrefixKey = peeringServicePrefixKey; + 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 (events() != null) { + events().forEach(e -> e.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..da060a5aa1da --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/fluent/models/PeeringServiceProviderInner.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.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; +import java.util.List; + +/** 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; + + /* + * The list of locations at which the service provider peers with + * Microsoft. + */ + @JsonProperty(value = "properties.peeringLocations") + private List peeringLocations; + + /** + * 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; + } + + /** + * Get the peeringLocations property: The list of locations at which the service provider peers with Microsoft. + * + * @return the peeringLocations value. + */ + public List peeringLocations() { + return this.peeringLocations; + } + + /** + * Set the peeringLocations property: The list of locations at which the service provider peers with Microsoft. + * + * @param peeringLocations the peeringLocations value to set. + * @return the PeeringServiceProviderInner object itself. + */ + public PeeringServiceProviderInner withPeeringLocations(List peeringLocations) { + this.peeringLocations = peeringLocations; + 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/CdnPeeringPrefixImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/CdnPeeringPrefixImpl.java new file mode 100644 index 000000000000..eb36846e4374 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/CdnPeeringPrefixImpl.java @@ -0,0 +1,60 @@ +// 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.PeeringManager; +import com.azure.resourcemanager.peering.fluent.models.CdnPeeringPrefixInner; +import com.azure.resourcemanager.peering.models.CdnPeeringPrefix; + +public final class CdnPeeringPrefixImpl implements CdnPeeringPrefix { + private CdnPeeringPrefixInner innerObject; + + private final PeeringManager serviceManager; + + CdnPeeringPrefixImpl(CdnPeeringPrefixInner innerObject, 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 prefix() { + return this.innerModel().prefix(); + } + + public String azureRegion() { + return this.innerModel().azureRegion(); + } + + public String azureService() { + return this.innerModel().azureService(); + } + + public Boolean isPrimaryRegion() { + return this.innerModel().isPrimaryRegion(); + } + + public String bgpCommunity() { + return this.innerModel().bgpCommunity(); + } + + public CdnPeeringPrefixInner innerModel() { + return this.innerObject; + } + + private PeeringManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/CdnPeeringPrefixesClientImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/CdnPeeringPrefixesClientImpl.java new file mode 100644 index 000000000000..4c8344a7dbc1 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/CdnPeeringPrefixesClientImpl.java @@ -0,0 +1,316 @@ +// 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.CdnPeeringPrefixesClient; +import com.azure.resourcemanager.peering.fluent.models.CdnPeeringPrefixInner; +import com.azure.resourcemanager.peering.models.CdnPeeringPrefixListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CdnPeeringPrefixesClient. */ +public final class CdnPeeringPrefixesClientImpl implements CdnPeeringPrefixesClient { + private final ClientLogger logger = new ClientLogger(CdnPeeringPrefixesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CdnPeeringPrefixesService service; + + /** The service client containing this operation class. */ + private final PeeringManagementClientImpl client; + + /** + * Initializes an instance of CdnPeeringPrefixesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CdnPeeringPrefixesClientImpl(PeeringManagementClientImpl client) { + this.service = + RestProxy.create(CdnPeeringPrefixesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PeeringManagementClientCdnPeeringPrefixes to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PeeringManagementCli") + private interface CdnPeeringPrefixesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Peering/cdnPeeringPrefixes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("peeringLocation") String peeringLocation, + @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 advertised prefixes for the specified peering location. + * + * @param peeringLocation The peering location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 CDN peering prefixes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String peeringLocation) { + 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 (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, + 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists all of the advertised prefixes for the specified peering location. + * + * @param peeringLocation The peering location. + * @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 CDN peering prefixes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String peeringLocation, 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 (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, + 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 advertised prefixes for the specified peering location. + * + * @param peeringLocation The peering location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 CDN peering prefixes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String peeringLocation) { + return new PagedFlux<>( + () -> listSinglePageAsync(peeringLocation), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the advertised prefixes for the specified peering location. + * + * @param peeringLocation The peering location. + * @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 CDN peering prefixes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String peeringLocation, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(peeringLocation, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the advertised prefixes for the specified peering location. + * + * @param peeringLocation The peering location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 CDN peering prefixes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String peeringLocation) { + return new PagedIterable<>(listAsync(peeringLocation)); + } + + /** + * Lists all of the advertised prefixes for the specified peering location. + * + * @param peeringLocation The peering location. + * @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 CDN peering prefixes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String peeringLocation, Context context) { + return new PagedIterable<>(listAsync(peeringLocation, 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 CDN peering prefixes. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 CDN peering prefixes. + */ + @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/CdnPeeringPrefixesImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/CdnPeeringPrefixesImpl.java new file mode 100644 index 000000000000..c7e37544b40b --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/CdnPeeringPrefixesImpl.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.PeeringManager; +import com.azure.resourcemanager.peering.fluent.CdnPeeringPrefixesClient; +import com.azure.resourcemanager.peering.fluent.models.CdnPeeringPrefixInner; +import com.azure.resourcemanager.peering.models.CdnPeeringPrefix; +import com.azure.resourcemanager.peering.models.CdnPeeringPrefixes; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CdnPeeringPrefixesImpl implements CdnPeeringPrefixes { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CdnPeeringPrefixesImpl.class); + + private final CdnPeeringPrefixesClient innerClient; + + private final PeeringManager serviceManager; + + public CdnPeeringPrefixesImpl(CdnPeeringPrefixesClient innerClient, PeeringManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String peeringLocation) { + PagedIterable inner = this.serviceClient().list(peeringLocation); + return Utils.mapPage(inner, inner1 -> new CdnPeeringPrefixImpl(inner1, this.manager())); + } + + public PagedIterable list(String peeringLocation, Context context) { + PagedIterable inner = this.serviceClient().list(peeringLocation, context); + return Utils.mapPage(inner, inner1 -> new CdnPeeringPrefixImpl(inner1, this.manager())); + } + + private CdnPeeringPrefixesClient serviceClient() { + return this.innerClient; + } + + private PeeringManager manager() { + return this.serviceManager; + } +} 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..8b1d9f760d45 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/LegacyPeeringsClientImpl.java @@ -0,0 +1,362 @@ +// 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, + @QueryParam("asn") Integer asn, + @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. + * @param asn The ASN number associated with a legacy 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, Integer asn) { + 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, + asn, + 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 asn The ASN number associated with a legacy 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, Integer asn, 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, + asn, + 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. + * @param asn The ASN number associated with a legacy 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, Integer asn) { + return new PagedFlux<>( + () -> listSinglePageAsync(peeringLocation, kind, asn), 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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) { + final Integer asn = null; + return new PagedFlux<>( + () -> listSinglePageAsync(peeringLocation, kind, asn), 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 asn The ASN number associated with a legacy 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, Integer asn, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(peeringLocation, kind, asn, 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) { + final Integer asn = null; + return new PagedIterable<>(listAsync(peeringLocation, kind, asn)); + } + + /** + * 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 asn The ASN number associated with a legacy 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, Integer asn, Context context) { + return new PagedIterable<>(listAsync(peeringLocation, kind, asn, 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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..d8b98acd2560 --- /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.PeeringManager; +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 PeeringManager serviceManager; + + public LegacyPeeringsImpl(LegacyPeeringsClient innerClient, 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, Integer asn, Context context) { + PagedIterable inner = this.serviceClient().list(peeringLocation, kind, asn, context); + return Utils.mapPage(inner, inner1 -> new PeeringImpl(inner1, this.manager())); + } + + private LegacyPeeringsClient serviceClient() { + return this.innerClient; + } + + private 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..c1ef91623047 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/OperationImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.implementation; + +import com.azure.resourcemanager.peering.PeeringManager; +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 PeeringManager serviceManager; + + OperationImpl(OperationInner innerObject, 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 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..a89553ade75f --- /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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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..839437710585 --- /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.PeeringManager; +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 PeeringManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, 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 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..b88ab12ddd7a --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeerAsnImpl.java @@ -0,0 +1,155 @@ +// 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.PeeringManager; +import com.azure.resourcemanager.peering.fluent.models.PeerAsnInner; +import com.azure.resourcemanager.peering.models.ContactDetail; +import com.azure.resourcemanager.peering.models.PeerAsn; +import com.azure.resourcemanager.peering.models.ValidationState; +import java.util.Collections; +import java.util.List; + +public final class PeerAsnImpl implements PeerAsn, PeerAsn.Definition, PeerAsn.Update { + private PeerAsnInner innerObject; + + private final 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 List peerContactDetail() { + List inner = this.innerModel().peerContactDetail(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String peerName() { + return this.innerModel().peerName(); + } + + public ValidationState validationState() { + return this.innerModel().validationState(); + } + + public String errorMessage() { + return this.innerModel().errorMessage(); + } + + public PeerAsnInner innerModel() { + return this.innerObject; + } + + private 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, 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, 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 withPeerContactDetail(List peerContactDetail) { + this.innerModel().withPeerContactDetail(peerContactDetail); + 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..619a27f8403d --- /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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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..44314a48a655 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeerAsnsImpl.java @@ -0,0 +1,126 @@ +// 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.PeeringManager; +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 PeeringManager serviceManager; + + public PeerAsnsImpl(PeerAsnsClient innerClient, 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 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..e0742cc0e2a7 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringImpl.java @@ -0,0 +1,228 @@ +// 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.PeeringManager; +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 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 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, 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, 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..5eac8002efe2 --- /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.PeeringManager; +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 PeeringManager serviceManager; + + PeeringLocationImpl(PeeringLocationInner innerObject, 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 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..83e03dac20c5 --- /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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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..cce11e1d75c6 --- /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.PeeringManager; +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 PeeringManager serviceManager; + + public PeeringLocationsImpl(PeeringLocationsClient innerClient, 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 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..1f10890a52f1 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringManagementClientImpl.java @@ -0,0 +1,489 @@ +// 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.CdnPeeringPrefixesClient; +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.PeeringServiceCountriesClient; +import com.azure.resourcemanager.peering.fluent.PeeringServiceLocationsClient; +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.ReceivedRoutesClient; +import com.azure.resourcemanager.peering.fluent.RegisteredAsnsClient; +import com.azure.resourcemanager.peering.fluent.RegisteredPrefixesClient; +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 CdnPeeringPrefixesClient object to access its operations. */ + private final CdnPeeringPrefixesClient cdnPeeringPrefixes; + + /** + * Gets the CdnPeeringPrefixesClient object to access its operations. + * + * @return the CdnPeeringPrefixesClient object. + */ + public CdnPeeringPrefixesClient getCdnPeeringPrefixes() { + return this.cdnPeeringPrefixes; + } + + /** 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 RegisteredAsnsClient object to access its operations. */ + private final RegisteredAsnsClient registeredAsns; + + /** + * Gets the RegisteredAsnsClient object to access its operations. + * + * @return the RegisteredAsnsClient object. + */ + public RegisteredAsnsClient getRegisteredAsns() { + return this.registeredAsns; + } + + /** The RegisteredPrefixesClient object to access its operations. */ + private final RegisteredPrefixesClient registeredPrefixes; + + /** + * Gets the RegisteredPrefixesClient object to access its operations. + * + * @return the RegisteredPrefixesClient object. + */ + public RegisteredPrefixesClient getRegisteredPrefixes() { + return this.registeredPrefixes; + } + + /** 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 ReceivedRoutesClient object to access its operations. */ + private final ReceivedRoutesClient receivedRoutes; + + /** + * Gets the ReceivedRoutesClient object to access its operations. + * + * @return the ReceivedRoutesClient object. + */ + public ReceivedRoutesClient getReceivedRoutes() { + return this.receivedRoutes; + } + + /** The PeeringServiceCountriesClient object to access its operations. */ + private final PeeringServiceCountriesClient peeringServiceCountries; + + /** + * Gets the PeeringServiceCountriesClient object to access its operations. + * + * @return the PeeringServiceCountriesClient object. + */ + public PeeringServiceCountriesClient getPeeringServiceCountries() { + return this.peeringServiceCountries; + } + + /** 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 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 = "2021-01-01"; + this.cdnPeeringPrefixes = new CdnPeeringPrefixesClientImpl(this); + 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.registeredAsns = new RegisteredAsnsClientImpl(this); + this.registeredPrefixes = new RegisteredPrefixesClientImpl(this); + this.peerings = new PeeringsClientImpl(this); + this.receivedRoutes = new ReceivedRoutesClientImpl(this); + this.peeringServiceCountries = new PeeringServiceCountriesClientImpl(this); + this.peeringServiceLocations = new PeeringServiceLocationsClientImpl(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/PeeringReceivedRouteImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringReceivedRouteImpl.java new file mode 100644 index 000000000000..9e0d3a6041e0 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringReceivedRouteImpl.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.implementation; + +import com.azure.resourcemanager.peering.PeeringManager; +import com.azure.resourcemanager.peering.fluent.models.PeeringReceivedRouteInner; +import com.azure.resourcemanager.peering.models.PeeringReceivedRoute; + +public final class PeeringReceivedRouteImpl implements PeeringReceivedRoute { + private PeeringReceivedRouteInner innerObject; + + private final PeeringManager serviceManager; + + PeeringReceivedRouteImpl(PeeringReceivedRouteInner innerObject, PeeringManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String prefix() { + return this.innerModel().prefix(); + } + + public String nextHop() { + return this.innerModel().nextHop(); + } + + public String asPath() { + return this.innerModel().asPath(); + } + + public String originAsValidationState() { + return this.innerModel().originAsValidationState(); + } + + public String rpkiValidationState() { + return this.innerModel().rpkiValidationState(); + } + + public String trustAnchor() { + return this.innerModel().trustAnchor(); + } + + public String receivedTimestamp() { + return this.innerModel().receivedTimestamp(); + } + + public PeeringReceivedRouteInner innerModel() { + return this.innerObject; + } + + private PeeringManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringRegisteredAsnImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringRegisteredAsnImpl.java new file mode 100644 index 000000000000..0e2eac66206d --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringRegisteredAsnImpl.java @@ -0,0 +1,149 @@ +// 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.PeeringManager; +import com.azure.resourcemanager.peering.fluent.models.PeeringRegisteredAsnInner; +import com.azure.resourcemanager.peering.models.PeeringRegisteredAsn; +import com.azure.resourcemanager.peering.models.ProvisioningState; + +public final class PeeringRegisteredAsnImpl + implements PeeringRegisteredAsn, PeeringRegisteredAsn.Definition, PeeringRegisteredAsn.Update { + private PeeringRegisteredAsnInner innerObject; + + private final 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 asn() { + return this.innerModel().asn(); + } + + public String peeringServicePrefixKey() { + return this.innerModel().peeringServicePrefixKey(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public PeeringRegisteredAsnInner innerModel() { + return this.innerObject; + } + + private PeeringManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String peeringName; + + private String registeredAsnName; + + public PeeringRegisteredAsnImpl withExistingPeering(String resourceGroupName, String peeringName) { + this.resourceGroupName = resourceGroupName; + this.peeringName = peeringName; + return this; + } + + public PeeringRegisteredAsn create() { + this.innerObject = + serviceManager + .serviceClient() + .getRegisteredAsns() + .createOrUpdateWithResponse( + resourceGroupName, peeringName, registeredAsnName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public PeeringRegisteredAsn create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRegisteredAsns() + .createOrUpdateWithResponse( + resourceGroupName, peeringName, registeredAsnName, this.innerModel(), context) + .getValue(); + return this; + } + + PeeringRegisteredAsnImpl(String name, PeeringManager serviceManager) { + this.innerObject = new PeeringRegisteredAsnInner(); + this.serviceManager = serviceManager; + this.registeredAsnName = name; + } + + public PeeringRegisteredAsnImpl update() { + return this; + } + + public PeeringRegisteredAsn apply() { + this.innerObject = + serviceManager + .serviceClient() + .getRegisteredAsns() + .createOrUpdateWithResponse( + resourceGroupName, peeringName, registeredAsnName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public PeeringRegisteredAsn apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRegisteredAsns() + .createOrUpdateWithResponse( + resourceGroupName, peeringName, registeredAsnName, this.innerModel(), context) + .getValue(); + return this; + } + + PeeringRegisteredAsnImpl(PeeringRegisteredAsnInner innerObject, PeeringManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.peeringName = Utils.getValueFromIdByName(innerObject.id(), "peerings"); + this.registeredAsnName = Utils.getValueFromIdByName(innerObject.id(), "registeredAsns"); + } + + public PeeringRegisteredAsn refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getRegisteredAsns() + .getWithResponse(resourceGroupName, peeringName, registeredAsnName, Context.NONE) + .getValue(); + return this; + } + + public PeeringRegisteredAsn refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRegisteredAsns() + .getWithResponse(resourceGroupName, peeringName, registeredAsnName, context) + .getValue(); + return this; + } + + public PeeringRegisteredAsnImpl withAsn(Integer asn) { + this.innerModel().withAsn(asn); + return this; + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringRegisteredPrefixImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringRegisteredPrefixImpl.java new file mode 100644 index 000000000000..ee66cb7ec86d --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringRegisteredPrefixImpl.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.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.peering.PeeringManager; +import com.azure.resourcemanager.peering.fluent.models.PeeringRegisteredPrefixInner; +import com.azure.resourcemanager.peering.models.PeeringRegisteredPrefix; +import com.azure.resourcemanager.peering.models.PrefixValidationState; +import com.azure.resourcemanager.peering.models.ProvisioningState; + +public final class PeeringRegisteredPrefixImpl + implements PeeringRegisteredPrefix, PeeringRegisteredPrefix.Definition, PeeringRegisteredPrefix.Update { + private PeeringRegisteredPrefixInner innerObject; + + private final 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 String peeringServicePrefixKey() { + return this.innerModel().peeringServicePrefixKey(); + } + + public String errorMessage() { + return this.innerModel().errorMessage(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public PeeringRegisteredPrefixInner innerModel() { + return this.innerObject; + } + + private PeeringManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String peeringName; + + private String registeredPrefixName; + + public PeeringRegisteredPrefixImpl withExistingPeering(String resourceGroupName, String peeringName) { + this.resourceGroupName = resourceGroupName; + this.peeringName = peeringName; + return this; + } + + public PeeringRegisteredPrefix create() { + this.innerObject = + serviceManager + .serviceClient() + .getRegisteredPrefixes() + .createOrUpdateWithResponse( + resourceGroupName, peeringName, registeredPrefixName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public PeeringRegisteredPrefix create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRegisteredPrefixes() + .createOrUpdateWithResponse( + resourceGroupName, peeringName, registeredPrefixName, this.innerModel(), context) + .getValue(); + return this; + } + + PeeringRegisteredPrefixImpl(String name, PeeringManager serviceManager) { + this.innerObject = new PeeringRegisteredPrefixInner(); + this.serviceManager = serviceManager; + this.registeredPrefixName = name; + } + + public PeeringRegisteredPrefixImpl update() { + return this; + } + + public PeeringRegisteredPrefix apply() { + this.innerObject = + serviceManager + .serviceClient() + .getRegisteredPrefixes() + .createOrUpdateWithResponse( + resourceGroupName, peeringName, registeredPrefixName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public PeeringRegisteredPrefix apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRegisteredPrefixes() + .createOrUpdateWithResponse( + resourceGroupName, peeringName, registeredPrefixName, this.innerModel(), context) + .getValue(); + return this; + } + + PeeringRegisteredPrefixImpl(PeeringRegisteredPrefixInner innerObject, PeeringManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.peeringName = Utils.getValueFromIdByName(innerObject.id(), "peerings"); + this.registeredPrefixName = Utils.getValueFromIdByName(innerObject.id(), "registeredPrefixes"); + } + + public PeeringRegisteredPrefix refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getRegisteredPrefixes() + .getWithResponse(resourceGroupName, peeringName, registeredPrefixName, Context.NONE) + .getValue(); + return this; + } + + public PeeringRegisteredPrefix refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRegisteredPrefixes() + .getWithResponse(resourceGroupName, peeringName, registeredPrefixName, context) + .getValue(); + return this; + } + + public PeeringRegisteredPrefixImpl withPrefix(String prefix) { + this.innerModel().withPrefix(prefix); + return this; + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceCountriesClientImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceCountriesClientImpl.java new file mode 100644 index 000000000000..1e9101d54d7e --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceCountriesClientImpl.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.Resource; +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.PeeringServiceCountriesClient; +import com.azure.resourcemanager.peering.models.PeeringServiceCountryListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PeeringServiceCountriesClient. */ +public final class PeeringServiceCountriesClientImpl implements PeeringServiceCountriesClient { + private final ClientLogger logger = new ClientLogger(PeeringServiceCountriesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PeeringServiceCountriesService service; + + /** The service client containing this operation class. */ + private final PeeringManagementClientImpl client; + + /** + * Initializes an instance of PeeringServiceCountriesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PeeringServiceCountriesClientImpl(PeeringManagementClientImpl client) { + this.service = + RestProxy + .create(PeeringServiceCountriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PeeringManagementClientPeeringServiceCountries to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PeeringManagementCli") + private interface PeeringServiceCountriesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceCountries") + @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 countries for peering service. + * + * @throws ManagementException 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 countries. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists all of the available countries for 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 paginated list of peering service countries. + */ + @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 countries for peering service. + * + * @throws ManagementException 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 countries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available countries for 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 paginated list of peering service countries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available countries for peering service. + * + * @throws ManagementException 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 countries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available countries for 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 paginated list of peering service countries. + */ + @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 countries. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 countries. + */ + @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/PeeringServiceCountriesImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceCountriesImpl.java new file mode 100644 index 000000000000..d2068a0ce1b1 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceCountriesImpl.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.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.Resource; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.peering.PeeringManager; +import com.azure.resourcemanager.peering.fluent.PeeringServiceCountriesClient; +import com.azure.resourcemanager.peering.models.PeeringServiceCountries; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PeeringServiceCountriesImpl implements PeeringServiceCountries { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringServiceCountriesImpl.class); + + private final PeeringServiceCountriesClient innerClient; + + private final PeeringManager serviceManager; + + public PeeringServiceCountriesImpl(PeeringServiceCountriesClient innerClient, PeeringManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + return this.serviceClient().list(); + } + + public PagedIterable list(Context context) { + return this.serviceClient().list(context); + } + + private PeeringServiceCountriesClient serviceClient() { + return this.innerClient; + } + + private PeeringManager manager() { + return this.serviceManager; + } +} 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..02699ed72433 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceImpl.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.peering.PeeringManager; +import com.azure.resourcemanager.peering.fluent.models.PeeringServiceInner; +import com.azure.resourcemanager.peering.models.PeeringService; +import com.azure.resourcemanager.peering.models.PeeringServiceSku; +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 PeeringManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PeeringServiceSku sku() { + return this.innerModel().sku(); + } + + 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 String providerPrimaryPeeringLocation() { + return this.innerModel().providerPrimaryPeeringLocation(); + } + + public String providerBackupPeeringLocation() { + return this.innerModel().providerBackupPeeringLocation(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public PeeringServiceInner innerModel() { + return this.innerObject; + } + + private 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, 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, 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 withSku(PeeringServiceSku sku) { + this.innerModel().withSku(sku); + return this; + } + + public PeeringServiceImpl withPeeringServiceLocation(String peeringServiceLocation) { + this.innerModel().withPeeringServiceLocation(peeringServiceLocation); + return this; + } + + public PeeringServiceImpl withPeeringServiceProvider(String peeringServiceProvider) { + this.innerModel().withPeeringServiceProvider(peeringServiceProvider); + return this; + } + + public PeeringServiceImpl withProviderPrimaryPeeringLocation(String providerPrimaryPeeringLocation) { + this.innerModel().withProviderPrimaryPeeringLocation(providerPrimaryPeeringLocation); + return this; + } + + public PeeringServiceImpl withProviderBackupPeeringLocation(String providerBackupPeeringLocation) { + this.innerModel().withProviderBackupPeeringLocation(providerBackupPeeringLocation); + 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..b67ab1b183f5 --- /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.PeeringManager; +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 PeeringManager serviceManager; + + PeeringServiceLocationImpl(PeeringServiceLocationInner innerObject, 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 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..5f5a2e5593f3 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceLocationsClientImpl.java @@ -0,0 +1,319 @@ +// 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, + @QueryParam("country") String country, + @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 locations for peering service. + * + * @param country The country of interest, in which the locations are to be present. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(String country) { + 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(), + country, + 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists all of the available locations for peering service. + * + * @param country The country of interest, in which the locations are to be present. + * @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(String country, 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(), + country, + 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 locations for peering service. + * + * @param country The country of interest, in which the locations are to be present. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(String country) { + return new PagedFlux<>(() -> listSinglePageAsync(country), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available locations for peering service. + * + * @throws ManagementException 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() { + final String country = null; + return new PagedFlux<>(() -> listSinglePageAsync(country), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available locations for peering service. + * + * @param country The country of interest, in which the locations are to be present. + * @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(String country, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(country, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available locations for peering service. + * + * @throws ManagementException 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() { + final String country = null; + return new PagedIterable<>(listAsync(country)); + } + + /** + * Lists all of the available locations for peering service. + * + * @param country The country of interest, in which the locations are to be present. + * @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(String country, Context context) { + return new PagedIterable<>(listAsync(country, 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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..e40cc4d04ac2 --- /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.PeeringManager; +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 PeeringManager serviceManager; + + public PeeringServiceLocationsImpl(PeeringServiceLocationsClient innerClient, 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(String country, Context context) { + PagedIterable inner = this.serviceClient().list(country, context); + return Utils.mapPage(inner, inner1 -> new PeeringServiceLocationImpl(inner1, this.manager())); + } + + private PeeringServiceLocationsClient serviceClient() { + return this.innerClient; + } + + private 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..992678937abc --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServicePrefixImpl.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.util.Context; +import com.azure.resourcemanager.peering.PeeringManager; +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.PeeringServicePrefixEvent; +import com.azure.resourcemanager.peering.models.PrefixValidationState; +import com.azure.resourcemanager.peering.models.ProvisioningState; +import java.util.Collections; +import java.util.List; + +public final class PeeringServicePrefixImpl + implements PeeringServicePrefix, PeeringServicePrefix.Definition, PeeringServicePrefix.Update { + private PeeringServicePrefixInner innerObject; + + private final 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 String errorMessage() { + return this.innerModel().errorMessage(); + } + + public List events() { + List inner = this.innerModel().events(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String peeringServicePrefixKey() { + return this.innerModel().peeringServicePrefixKey(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public PeeringServicePrefixInner innerModel() { + return this.innerObject; + } + + private 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() + .getPrefixes() + .createOrUpdateWithResponse( + resourceGroupName, peeringServiceName, prefixName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public PeeringServicePrefix create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrefixes() + .createOrUpdateWithResponse( + resourceGroupName, peeringServiceName, prefixName, this.innerModel(), context) + .getValue(); + return this; + } + + PeeringServicePrefixImpl(String name, PeeringManager serviceManager) { + this.innerObject = new PeeringServicePrefixInner(); + this.serviceManager = serviceManager; + this.prefixName = name; + } + + public PeeringServicePrefixImpl update() { + return this; + } + + public PeeringServicePrefix apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPrefixes() + .createOrUpdateWithResponse( + resourceGroupName, peeringServiceName, prefixName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public PeeringServicePrefix apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrefixes() + .createOrUpdateWithResponse( + resourceGroupName, peeringServiceName, prefixName, this.innerModel(), context) + .getValue(); + return this; + } + + PeeringServicePrefixImpl(PeeringServicePrefixInner innerObject, 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() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getPrefixes() + .getWithResponse(resourceGroupName, peeringServiceName, prefixName, localExpand, Context.NONE) + .getValue(); + return this; + } + + public PeeringServicePrefix refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getPrefixes() + .getWithResponse(resourceGroupName, peeringServiceName, prefixName, localExpand, context) + .getValue(); + return this; + } + + public PeeringServicePrefixImpl withPrefix(String prefix) { + this.innerModel().withPrefix(prefix); + return this; + } + + public PeeringServicePrefixImpl withPeeringServicePrefixKey(String peeringServicePrefixKey) { + this.innerModel().withPeeringServicePrefixKey(peeringServicePrefixKey); + return this; + } +} 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..77a74cf62624 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringServiceProviderImpl.java @@ -0,0 +1,55 @@ +// 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.PeeringManager; +import com.azure.resourcemanager.peering.fluent.models.PeeringServiceProviderInner; +import com.azure.resourcemanager.peering.models.PeeringServiceProvider; +import java.util.Collections; +import java.util.List; + +public final class PeeringServiceProviderImpl implements PeeringServiceProvider { + private PeeringServiceProviderInner innerObject; + + private final PeeringManager serviceManager; + + PeeringServiceProviderImpl(PeeringServiceProviderInner innerObject, 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 List peeringLocations() { + List inner = this.innerModel().peeringLocations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PeeringServiceProviderInner innerModel() { + return this.innerObject; + } + + private 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..15b009955490 --- /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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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..3c3258d7099a --- /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.PeeringManager; +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 PeeringManager serviceManager; + + public PeeringServiceProvidersImpl(PeeringServiceProvidersClient innerClient, 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 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..378b6405ca31 --- /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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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..cb853763631a --- /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.PeeringManager; +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 PeeringManager serviceManager; + + public PeeringServicesImpl(PeeringServicesClient innerClient, 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 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..ecef36ee8d27 --- /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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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..793bf0f90fb6 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PeeringsImpl.java @@ -0,0 +1,170 @@ +// 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.PeeringManager; +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 PeeringManager serviceManager; + + public PeeringsImpl(PeeringsClient innerClient, 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 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..ef91e1978d45 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PrefixesClientImpl.java @@ -0,0 +1,993 @@ +// 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.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/{prefixName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("peeringServiceName") String peeringServiceName, + @PathParam("prefixName") String prefixName, + @QueryParam("$expand") String expand, + @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); + + @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, + @QueryParam("$expand") String expand, + @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); + } + + /** + * Gets an existing prefix with the specified name under the given subscription, resource group and peering service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @param expand The properties to be expanded. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 prefix with the specified name under the given subscription, resource group and peering + * service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String peeringServiceName, String prefixName, String expand) { + 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, + expand, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets an existing prefix with the specified name under the given subscription, resource group and peering service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @param expand The properties to be expanded. + * @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 prefix with the specified name under the given subscription, resource group and peering + * service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String peeringServiceName, String prefixName, String expand, 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, + expand, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets an existing prefix with the specified name under the given subscription, resource group and peering service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @param expand The properties to be expanded. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 prefix with the specified name under the given subscription, resource group and peering + * service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String peeringServiceName, String prefixName, String expand) { + return getWithResponseAsync(resourceGroupName, peeringServiceName, prefixName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an existing prefix with the specified name under the given subscription, resource group and peering service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 prefix with the specified name under the given subscription, resource group and peering + * service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String peeringServiceName, String prefixName) { + final String expand = null; + return getWithResponseAsync(resourceGroupName, peeringServiceName, prefixName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an existing prefix with the specified name under the given subscription, resource group and peering service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 prefix with the specified name under the given subscription, resource group and peering + * service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PeeringServicePrefixInner get(String resourceGroupName, String peeringServiceName, String prefixName) { + final String expand = null; + return getAsync(resourceGroupName, peeringServiceName, prefixName, expand).block(); + } + + /** + * Gets an existing prefix with the specified name under the given subscription, resource group and peering service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @param expand The properties to be expanded. + * @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 prefix with the specified name under the given subscription, resource group and peering + * service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String peeringServiceName, String prefixName, String expand, Context context) { + return getWithResponseAsync(resourceGroupName, peeringServiceName, prefixName, expand, context).block(); + } + + /** + * Creates a new prefix with the specified name under the given subscription, resource group and peering service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @param peeringServicePrefix The properties needed to create a prefix. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates a new prefix with the specified name under the given subscription, resource group and peering service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @param peeringServicePrefix The properties needed to create a prefix. + * @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 a new prefix with the specified name under the given subscription, resource group and peering service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @param peeringServicePrefix The properties needed to create a prefix. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 a new prefix with the specified name under the given subscription, resource group and peering service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @param peeringServicePrefix The properties needed to create a prefix. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 a new prefix with the specified name under the given subscription, resource group and peering service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @param peeringServicePrefix The properties needed to create a prefix. + * @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(); + } + + /** + * Deletes an existing prefix with the specified name under the given subscription, resource group and peering + * service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an existing prefix with the specified name under the given subscription, resource group and peering + * service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @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); + } + + /** + * Deletes an existing prefix with the specified name under the given subscription, resource group and peering + * service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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()); + } + + /** + * Deletes an existing prefix with the specified name under the given subscription, resource group and peering + * service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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(); + } + + /** + * Deletes an existing prefix with the specified name under the given subscription, resource group and peering + * service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @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(); + } + + /** + * Lists all prefixes under the given subscription, resource group and peering service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param expand The properties to be expanded. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 prefixes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPeeringServiceSinglePageAsync( + String resourceGroupName, String peeringServiceName, String expand) { + 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, + expand, + 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists all prefixes under the given subscription, resource group and peering service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param expand The properties to be expanded. + * @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 prefixes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPeeringServiceSinglePageAsync( + String resourceGroupName, String peeringServiceName, String expand, 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, + expand, + 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 prefixes under the given subscription, resource group and peering service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param expand The properties to be expanded. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 prefixes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByPeeringServiceAsync( + String resourceGroupName, String peeringServiceName, String expand) { + return new PagedFlux<>( + () -> listByPeeringServiceSinglePageAsync(resourceGroupName, peeringServiceName, expand), + nextLink -> listByPeeringServiceNextSinglePageAsync(nextLink)); + } + + /** + * Lists all prefixes under the given subscription, resource group and peering service. + * + * @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 paginated list of peering service prefixes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByPeeringServiceAsync( + String resourceGroupName, String peeringServiceName) { + final String expand = null; + return new PagedFlux<>( + () -> listByPeeringServiceSinglePageAsync(resourceGroupName, peeringServiceName, expand), + nextLink -> listByPeeringServiceNextSinglePageAsync(nextLink)); + } + + /** + * Lists all prefixes under the given subscription, resource group and peering service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param expand The properties to be expanded. + * @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 prefixes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByPeeringServiceAsync( + String resourceGroupName, String peeringServiceName, String expand, Context context) { + return new PagedFlux<>( + () -> listByPeeringServiceSinglePageAsync(resourceGroupName, peeringServiceName, expand, context), + nextLink -> listByPeeringServiceNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all prefixes under the given subscription, resource group and peering service. + * + * @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 paginated list of peering service prefixes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByPeeringService( + String resourceGroupName, String peeringServiceName) { + final String expand = null; + return new PagedIterable<>(listByPeeringServiceAsync(resourceGroupName, peeringServiceName, expand)); + } + + /** + * Lists all prefixes under the given subscription, resource group and peering service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param expand The properties to be expanded. + * @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 prefixes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByPeeringService( + String resourceGroupName, String peeringServiceName, String expand, Context context) { + return new PagedIterable<>(listByPeeringServiceAsync(resourceGroupName, peeringServiceName, expand, 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 prefixes. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 prefixes. + */ + @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..0cfef85b33d4 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/PrefixesImpl.java @@ -0,0 +1,200 @@ +// 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.PeeringManager; +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 PeeringManager serviceManager; + + public PrefixesImpl(PrefixesClient innerClient, 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, String expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, peeringServiceName, prefixName, expand, 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 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, String expand, Context context) { + PagedIterable inner = + this.serviceClient().listByPeeringService(resourceGroupName, peeringServiceName, expand, context); + return Utils.mapPage(inner, inner1 -> new PeeringServicePrefixImpl(inner1, this.manager())); + } + + 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))); + } + String localExpand = null; + return this + .getWithResponse(resourceGroupName, peeringServiceName, prefixName, localExpand, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, String expand, 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, expand, 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 PrefixesClient serviceClient() { + return this.innerClient; + } + + private 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/ReceivedRoutesClientImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/ReceivedRoutesClientImpl.java new file mode 100644 index 000000000000..09a29c5c3d4a --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/ReceivedRoutesClientImpl.java @@ -0,0 +1,482 @@ +// 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.ReceivedRoutesClient; +import com.azure.resourcemanager.peering.fluent.models.PeeringReceivedRouteInner; +import com.azure.resourcemanager.peering.models.PeeringReceivedRouteListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ReceivedRoutesClient. */ +public final class ReceivedRoutesClientImpl implements ReceivedRoutesClient { + private final ClientLogger logger = new ClientLogger(ReceivedRoutesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ReceivedRoutesService service; + + /** The service client containing this operation class. */ + private final PeeringManagementClientImpl client; + + /** + * Initializes an instance of ReceivedRoutesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ReceivedRoutesClientImpl(PeeringManagementClientImpl client) { + this.service = + RestProxy.create(ReceivedRoutesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PeeringManagementClientReceivedRoutes to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PeeringManagementCli") + private interface ReceivedRoutesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings" + + "/{peeringName}/receivedRoutes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByPeering( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("peeringName") String peeringName, + @QueryParam("prefix") String prefix, + @QueryParam("asPath") String asPath, + @QueryParam("originAsValidationState") String originAsValidationState, + @QueryParam("rpkiValidationState") String rpkiValidationState, + @QueryParam("$skipToken") String skipToken, + @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> listByPeeringNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the prefixes received over the specified peering under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param prefix The optional prefix that can be used to filter the routes. + * @param asPath The optional AS path that can be used to filter the routes. + * @param originAsValidationState The optional origin AS validation state that can be used to filter the routes. + * @param rpkiValidationState The optional RPKI validation state that can be used to filter the routes. + * @param skipToken The optional page continuation token that is used in the event of paginated result. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 received routes for the peering. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPeeringSinglePageAsync( + String resourceGroupName, + String peeringName, + String prefix, + String asPath, + String originAsValidationState, + String rpkiValidationState, + String skipToken) { + 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 + .listByPeering( + this.client.getEndpoint(), + resourceGroupName, + peeringName, + prefix, + asPath, + originAsValidationState, + rpkiValidationState, + skipToken, + 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the prefixes received over the specified peering under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param prefix The optional prefix that can be used to filter the routes. + * @param asPath The optional AS path that can be used to filter the routes. + * @param originAsValidationState The optional origin AS validation state that can be used to filter the routes. + * @param rpkiValidationState The optional RPKI validation state that can be used to filter the routes. + * @param skipToken The optional page continuation token that is used in the event of paginated result. + * @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 received routes for the peering. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPeeringSinglePageAsync( + String resourceGroupName, + String peeringName, + String prefix, + String asPath, + String originAsValidationState, + String rpkiValidationState, + String skipToken, + 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 + .listByPeering( + this.client.getEndpoint(), + resourceGroupName, + peeringName, + prefix, + asPath, + originAsValidationState, + rpkiValidationState, + skipToken, + 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 prefixes received over the specified peering under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param prefix The optional prefix that can be used to filter the routes. + * @param asPath The optional AS path that can be used to filter the routes. + * @param originAsValidationState The optional origin AS validation state that can be used to filter the routes. + * @param rpkiValidationState The optional RPKI validation state that can be used to filter the routes. + * @param skipToken The optional page continuation token that is used in the event of paginated result. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 received routes for the peering. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByPeeringAsync( + String resourceGroupName, + String peeringName, + String prefix, + String asPath, + String originAsValidationState, + String rpkiValidationState, + String skipToken) { + return new PagedFlux<>( + () -> + listByPeeringSinglePageAsync( + resourceGroupName, + peeringName, + prefix, + asPath, + originAsValidationState, + rpkiValidationState, + skipToken), + nextLink -> listByPeeringNextSinglePageAsync(nextLink)); + } + + /** + * Lists the prefixes received over the specified peering 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 paginated list of received routes for the peering. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByPeeringAsync(String resourceGroupName, String peeringName) { + final String prefix = null; + final String asPath = null; + final String originAsValidationState = null; + final String rpkiValidationState = null; + final String skipToken = null; + return new PagedFlux<>( + () -> + listByPeeringSinglePageAsync( + resourceGroupName, + peeringName, + prefix, + asPath, + originAsValidationState, + rpkiValidationState, + skipToken), + nextLink -> listByPeeringNextSinglePageAsync(nextLink)); + } + + /** + * Lists the prefixes received over the specified peering under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param prefix The optional prefix that can be used to filter the routes. + * @param asPath The optional AS path that can be used to filter the routes. + * @param originAsValidationState The optional origin AS validation state that can be used to filter the routes. + * @param rpkiValidationState The optional RPKI validation state that can be used to filter the routes. + * @param skipToken The optional page continuation token that is used in the event of paginated result. + * @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 received routes for the peering. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByPeeringAsync( + String resourceGroupName, + String peeringName, + String prefix, + String asPath, + String originAsValidationState, + String rpkiValidationState, + String skipToken, + Context context) { + return new PagedFlux<>( + () -> + listByPeeringSinglePageAsync( + resourceGroupName, + peeringName, + prefix, + asPath, + originAsValidationState, + rpkiValidationState, + skipToken, + context), + nextLink -> listByPeeringNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the prefixes received over the specified peering 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 paginated list of received routes for the peering. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByPeering(String resourceGroupName, String peeringName) { + final String prefix = null; + final String asPath = null; + final String originAsValidationState = null; + final String rpkiValidationState = null; + final String skipToken = null; + return new PagedIterable<>( + listByPeeringAsync( + resourceGroupName, + peeringName, + prefix, + asPath, + originAsValidationState, + rpkiValidationState, + skipToken)); + } + + /** + * Lists the prefixes received over the specified peering under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param prefix The optional prefix that can be used to filter the routes. + * @param asPath The optional AS path that can be used to filter the routes. + * @param originAsValidationState The optional origin AS validation state that can be used to filter the routes. + * @param rpkiValidationState The optional RPKI validation state that can be used to filter the routes. + * @param skipToken The optional page continuation token that is used in the event of paginated result. + * @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 received routes for the peering. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByPeering( + String resourceGroupName, + String peeringName, + String prefix, + String asPath, + String originAsValidationState, + String rpkiValidationState, + String skipToken, + Context context) { + return new PagedIterable<>( + listByPeeringAsync( + resourceGroupName, + peeringName, + prefix, + asPath, + originAsValidationState, + rpkiValidationState, + skipToken, + 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 received routes for the peering. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPeeringNextSinglePageAsync(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.listByPeeringNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 received routes for the peering. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPeeringNextSinglePageAsync( + 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 + .listByPeeringNext(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/ReceivedRoutesImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/ReceivedRoutesImpl.java new file mode 100644 index 000000000000..0a313d67a8f2 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/ReceivedRoutesImpl.java @@ -0,0 +1,66 @@ +// 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.PeeringManager; +import com.azure.resourcemanager.peering.fluent.ReceivedRoutesClient; +import com.azure.resourcemanager.peering.fluent.models.PeeringReceivedRouteInner; +import com.azure.resourcemanager.peering.models.PeeringReceivedRoute; +import com.azure.resourcemanager.peering.models.ReceivedRoutes; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ReceivedRoutesImpl implements ReceivedRoutes { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReceivedRoutesImpl.class); + + private final ReceivedRoutesClient innerClient; + + private final PeeringManager serviceManager; + + public ReceivedRoutesImpl(ReceivedRoutesClient innerClient, PeeringManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByPeering(String resourceGroupName, String peeringName) { + PagedIterable inner = + this.serviceClient().listByPeering(resourceGroupName, peeringName); + return Utils.mapPage(inner, inner1 -> new PeeringReceivedRouteImpl(inner1, this.manager())); + } + + public PagedIterable listByPeering( + String resourceGroupName, + String peeringName, + String prefix, + String asPath, + String originAsValidationState, + String rpkiValidationState, + String skipToken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByPeering( + resourceGroupName, + peeringName, + prefix, + asPath, + originAsValidationState, + rpkiValidationState, + skipToken, + context); + return Utils.mapPage(inner, inner1 -> new PeeringReceivedRouteImpl(inner1, this.manager())); + } + + private ReceivedRoutesClient serviceClient() { + return this.innerClient; + } + + private PeeringManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/RegisteredAsnsClientImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/RegisteredAsnsClientImpl.java new file mode 100644 index 000000000000..2030edb217e2 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/RegisteredAsnsClientImpl.java @@ -0,0 +1,924 @@ +// 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.RegisteredAsnsClient; +import com.azure.resourcemanager.peering.fluent.models.PeeringRegisteredAsnInner; +import com.azure.resourcemanager.peering.models.PeeringRegisteredAsnListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RegisteredAsnsClient. */ +public final class RegisteredAsnsClientImpl implements RegisteredAsnsClient { + private final ClientLogger logger = new ClientLogger(RegisteredAsnsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RegisteredAsnsService service; + + /** The service client containing this operation class. */ + private final PeeringManagementClientImpl client; + + /** + * Initializes an instance of RegisteredAsnsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RegisteredAsnsClientImpl(PeeringManagementClientImpl client) { + this.service = + RestProxy.create(RegisteredAsnsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PeeringManagementClientRegisteredAsns to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PeeringManagementCli") + private interface RegisteredAsnsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings" + + "/{peeringName}/registeredAsns/{registeredAsnName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("peeringName") String peeringName, + @PathParam("registeredAsnName") String registeredAsnName, + @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}/registeredAsns/{registeredAsnName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("peeringName") String peeringName, + @PathParam("registeredAsnName") String registeredAsnName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PeeringRegisteredAsnInner registeredAsn, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings" + + "/{peeringName}/registeredAsns/{registeredAsnName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("peeringName") String peeringName, + @PathParam("registeredAsnName") String registeredAsnName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings" + + "/{peeringName}/registeredAsns") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByPeering( + @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"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByPeeringNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets an existing registered ASN with the specified name under the given subscription, resource group and peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the registered 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 an existing registered ASN with the specified name under the given subscription, resource group and + * peering. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String peeringName, String registeredAsnName) { + 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 (registeredAsnName == null) { + return Mono + .error(new IllegalArgumentException("Parameter registeredAsnName 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, + peeringName, + registeredAsnName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets an existing registered ASN with the specified name under the given subscription, resource group and peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the registered 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 an existing registered ASN with the specified name under the given subscription, resource group and + * peering. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String peeringName, String registeredAsnName, 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 (registeredAsnName == null) { + return Mono + .error(new IllegalArgumentException("Parameter registeredAsnName 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, + peeringName, + registeredAsnName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets an existing registered ASN with the specified name under the given subscription, resource group and peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the registered 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 an existing registered ASN with the specified name under the given subscription, resource group and + * peering. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String peeringName, String registeredAsnName) { + return getWithResponseAsync(resourceGroupName, peeringName, registeredAsnName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an existing registered ASN with the specified name under the given subscription, resource group and peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the registered 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 an existing registered ASN with the specified name under the given subscription, resource group and + * peering. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PeeringRegisteredAsnInner get(String resourceGroupName, String peeringName, String registeredAsnName) { + return getAsync(resourceGroupName, peeringName, registeredAsnName).block(); + } + + /** + * Gets an existing registered ASN with the specified name under the given subscription, resource group and peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the registered 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 an existing registered ASN with the specified name under the given subscription, resource group and + * peering. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String peeringName, String registeredAsnName, Context context) { + return getWithResponseAsync(resourceGroupName, peeringName, registeredAsnName, context).block(); + } + + /** + * Creates a new registered ASN with the specified name under the given subscription, resource group and peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the ASN. + * @param registeredAsn The properties needed to create a registered 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 customer's ASN that is registered by the peering service provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String peeringName, + String registeredAsnName, + PeeringRegisteredAsnInner registeredAsn) { + 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 (registeredAsnName == null) { + return Mono + .error(new IllegalArgumentException("Parameter registeredAsnName 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 (registeredAsn == null) { + return Mono.error(new IllegalArgumentException("Parameter registeredAsn is required and cannot be null.")); + } else { + registeredAsn.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + peeringName, + registeredAsnName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + registeredAsn, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates a new registered ASN with the specified name under the given subscription, resource group and peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the ASN. + * @param registeredAsn The properties needed to create a registered 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 customer's ASN that is registered by the peering service provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String peeringName, + String registeredAsnName, + PeeringRegisteredAsnInner registeredAsn, + 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 (registeredAsnName == null) { + return Mono + .error(new IllegalArgumentException("Parameter registeredAsnName 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 (registeredAsn == null) { + return Mono.error(new IllegalArgumentException("Parameter registeredAsn is required and cannot be null.")); + } else { + registeredAsn.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + peeringName, + registeredAsnName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + registeredAsn, + accept, + context); + } + + /** + * Creates a new registered ASN with the specified name under the given subscription, resource group and peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the ASN. + * @param registeredAsn The properties needed to create a registered 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 customer's ASN that is registered by the peering service provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String peeringName, + String registeredAsnName, + PeeringRegisteredAsnInner registeredAsn) { + return createOrUpdateWithResponseAsync(resourceGroupName, peeringName, registeredAsnName, registeredAsn) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates a new registered ASN with the specified name under the given subscription, resource group and peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the ASN. + * @param registeredAsn The properties needed to create a registered 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 customer's ASN that is registered by the peering service provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PeeringRegisteredAsnInner createOrUpdate( + String resourceGroupName, + String peeringName, + String registeredAsnName, + PeeringRegisteredAsnInner registeredAsn) { + return createOrUpdateAsync(resourceGroupName, peeringName, registeredAsnName, registeredAsn).block(); + } + + /** + * Creates a new registered ASN with the specified name under the given subscription, resource group and peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the ASN. + * @param registeredAsn The properties needed to create a registered 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 customer's ASN that is registered by the peering service provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String peeringName, + String registeredAsnName, + PeeringRegisteredAsnInner registeredAsn, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, peeringName, registeredAsnName, registeredAsn, context) + .block(); + } + + /** + * Deletes an existing registered ASN with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the registered 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String peeringName, String registeredAsnName) { + 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 (registeredAsnName == null) { + return Mono + .error(new IllegalArgumentException("Parameter registeredAsnName 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, + registeredAsnName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an existing registered ASN with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the registered 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String peeringName, String registeredAsnName, 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 (registeredAsnName == null) { + return Mono + .error(new IllegalArgumentException("Parameter registeredAsnName 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, + registeredAsnName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes an existing registered ASN with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the registered 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String peeringName, String registeredAsnName) { + return deleteWithResponseAsync(resourceGroupName, peeringName, registeredAsnName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes an existing registered ASN with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the registered 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String peeringName, String registeredAsnName) { + deleteAsync(resourceGroupName, peeringName, registeredAsnName).block(); + } + + /** + * Deletes an existing registered ASN with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the registered 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String peeringName, String registeredAsnName, Context context) { + return deleteWithResponseAsync(resourceGroupName, peeringName, registeredAsnName, context).block(); + } + + /** + * Lists all registered ASNs under the given subscription, resource group and peering. + * + * @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 paginated list of peering registered ASNs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPeeringSinglePageAsync( + 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 + .listByPeering( + this.client.getEndpoint(), + resourceGroupName, + peeringName, + 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists all registered ASNs under the given subscription, resource group and peering. + * + * @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 paginated list of peering registered ASNs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPeeringSinglePageAsync( + 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 + .listByPeering( + this.client.getEndpoint(), + resourceGroupName, + peeringName, + 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 registered ASNs under the given subscription, resource group and peering. + * + * @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 paginated list of peering registered ASNs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByPeeringAsync(String resourceGroupName, String peeringName) { + return new PagedFlux<>( + () -> listByPeeringSinglePageAsync(resourceGroupName, peeringName), + nextLink -> listByPeeringNextSinglePageAsync(nextLink)); + } + + /** + * Lists all registered ASNs under the given subscription, resource group and peering. + * + * @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 paginated list of peering registered ASNs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByPeeringAsync( + String resourceGroupName, String peeringName, Context context) { + return new PagedFlux<>( + () -> listByPeeringSinglePageAsync(resourceGroupName, peeringName, context), + nextLink -> listByPeeringNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all registered ASNs under the given subscription, resource group and peering. + * + * @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 paginated list of peering registered ASNs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByPeering(String resourceGroupName, String peeringName) { + return new PagedIterable<>(listByPeeringAsync(resourceGroupName, peeringName)); + } + + /** + * Lists all registered ASNs under the given subscription, resource group and peering. + * + * @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 paginated list of peering registered ASNs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByPeering( + String resourceGroupName, String peeringName, Context context) { + return new PagedIterable<>(listByPeeringAsync(resourceGroupName, peeringName, 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 registered ASNs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPeeringNextSinglePageAsync(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.listByPeeringNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 registered ASNs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPeeringNextSinglePageAsync( + 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 + .listByPeeringNext(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/RegisteredAsnsImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/RegisteredAsnsImpl.java new file mode 100644 index 000000000000..be7603c581ab --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/RegisteredAsnsImpl.java @@ -0,0 +1,196 @@ +// 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.PeeringManager; +import com.azure.resourcemanager.peering.fluent.RegisteredAsnsClient; +import com.azure.resourcemanager.peering.fluent.models.PeeringRegisteredAsnInner; +import com.azure.resourcemanager.peering.models.PeeringRegisteredAsn; +import com.azure.resourcemanager.peering.models.RegisteredAsns; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RegisteredAsnsImpl implements RegisteredAsns { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegisteredAsnsImpl.class); + + private final RegisteredAsnsClient innerClient; + + private final PeeringManager serviceManager; + + public RegisteredAsnsImpl(RegisteredAsnsClient innerClient, PeeringManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PeeringRegisteredAsn get(String resourceGroupName, String peeringName, String registeredAsnName) { + PeeringRegisteredAsnInner inner = this.serviceClient().get(resourceGroupName, peeringName, registeredAsnName); + if (inner != null) { + return new PeeringRegisteredAsnImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String peeringName, String registeredAsnName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, peeringName, registeredAsnName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PeeringRegisteredAsnImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String peeringName, String registeredAsnName) { + this.serviceClient().delete(resourceGroupName, peeringName, registeredAsnName); + } + + public Response deleteWithResponse( + String resourceGroupName, String peeringName, String registeredAsnName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, peeringName, registeredAsnName, context); + } + + public PagedIterable listByPeering(String resourceGroupName, String peeringName) { + PagedIterable inner = + this.serviceClient().listByPeering(resourceGroupName, peeringName); + return Utils.mapPage(inner, inner1 -> new PeeringRegisteredAsnImpl(inner1, this.manager())); + } + + public PagedIterable listByPeering( + String resourceGroupName, String peeringName, Context context) { + PagedIterable inner = + this.serviceClient().listByPeering(resourceGroupName, peeringName, context); + return Utils.mapPage(inner, inner1 -> new PeeringRegisteredAsnImpl(inner1, this.manager())); + } + + public PeeringRegisteredAsn 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))); + } + String registeredAsnName = Utils.getValueFromIdByName(id, "registeredAsns"); + if (registeredAsnName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'registeredAsns'.", id))); + } + return this.getWithResponse(resourceGroupName, peeringName, registeredAsnName, 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))); + } + String registeredAsnName = Utils.getValueFromIdByName(id, "registeredAsns"); + if (registeredAsnName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'registeredAsns'.", id))); + } + return this.getWithResponse(resourceGroupName, peeringName, registeredAsnName, 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))); + } + String registeredAsnName = Utils.getValueFromIdByName(id, "registeredAsns"); + if (registeredAsnName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'registeredAsns'.", id))); + } + this.deleteWithResponse(resourceGroupName, peeringName, registeredAsnName, 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))); + } + String registeredAsnName = Utils.getValueFromIdByName(id, "registeredAsns"); + if (registeredAsnName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'registeredAsns'.", id))); + } + return this.deleteWithResponse(resourceGroupName, peeringName, registeredAsnName, context); + } + + private RegisteredAsnsClient serviceClient() { + return this.innerClient; + } + + private PeeringManager manager() { + return this.serviceManager; + } + + public PeeringRegisteredAsnImpl define(String name) { + return new PeeringRegisteredAsnImpl(name, this.manager()); + } +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/RegisteredPrefixesClientImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/RegisteredPrefixesClientImpl.java new file mode 100644 index 000000000000..1ad8d197d4c9 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/RegisteredPrefixesClientImpl.java @@ -0,0 +1,931 @@ +// 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.RegisteredPrefixesClient; +import com.azure.resourcemanager.peering.fluent.models.PeeringRegisteredPrefixInner; +import com.azure.resourcemanager.peering.models.PeeringRegisteredPrefixListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RegisteredPrefixesClient. */ +public final class RegisteredPrefixesClientImpl implements RegisteredPrefixesClient { + private final ClientLogger logger = new ClientLogger(RegisteredPrefixesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RegisteredPrefixesService service; + + /** The service client containing this operation class. */ + private final PeeringManagementClientImpl client; + + /** + * Initializes an instance of RegisteredPrefixesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RegisteredPrefixesClientImpl(PeeringManagementClientImpl client) { + this.service = + RestProxy.create(RegisteredPrefixesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PeeringManagementClientRegisteredPrefixes to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PeeringManagementCli") + private interface RegisteredPrefixesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings" + + "/{peeringName}/registeredPrefixes/{registeredPrefixName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("peeringName") String peeringName, + @PathParam("registeredPrefixName") String registeredPrefixName, + @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}/registeredPrefixes/{registeredPrefixName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("peeringName") String peeringName, + @PathParam("registeredPrefixName") String registeredPrefixName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PeeringRegisteredPrefixInner registeredPrefix, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings" + + "/{peeringName}/registeredPrefixes/{registeredPrefixName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("peeringName") String peeringName, + @PathParam("registeredPrefixName") String registeredPrefixName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings" + + "/{peeringName}/registeredPrefixes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByPeering( + @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"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByPeeringNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets an existing registered prefix with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 registered prefix with the specified name under the given subscription, resource group and + * peering. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String peeringName, String registeredPrefixName) { + 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 (registeredPrefixName == null) { + return Mono + .error(new IllegalArgumentException("Parameter registeredPrefixName 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, + peeringName, + registeredPrefixName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets an existing registered prefix with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @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 registered prefix with the specified name under the given subscription, resource group and + * peering. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String peeringName, String registeredPrefixName, 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 (registeredPrefixName == null) { + return Mono + .error(new IllegalArgumentException("Parameter registeredPrefixName 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, + peeringName, + registeredPrefixName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets an existing registered prefix with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 registered prefix with the specified name under the given subscription, resource group and + * peering. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String peeringName, String registeredPrefixName) { + return getWithResponseAsync(resourceGroupName, peeringName, registeredPrefixName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an existing registered prefix with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 registered prefix with the specified name under the given subscription, resource group and + * peering. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PeeringRegisteredPrefixInner get(String resourceGroupName, String peeringName, String registeredPrefixName) { + return getAsync(resourceGroupName, peeringName, registeredPrefixName).block(); + } + + /** + * Gets an existing registered prefix with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @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 registered prefix with the specified name under the given subscription, resource group and + * peering. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String peeringName, String registeredPrefixName, Context context) { + return getWithResponseAsync(resourceGroupName, peeringName, registeredPrefixName, context).block(); + } + + /** + * Creates a new registered prefix with the specified name under the given subscription, resource group and peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @param registeredPrefix The properties needed to create a registered prefix. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the customer's prefix that is registered by the peering service provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String peeringName, + String registeredPrefixName, + PeeringRegisteredPrefixInner registeredPrefix) { + 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 (registeredPrefixName == null) { + return Mono + .error(new IllegalArgumentException("Parameter registeredPrefixName 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 (registeredPrefix == null) { + return Mono + .error(new IllegalArgumentException("Parameter registeredPrefix is required and cannot be null.")); + } else { + registeredPrefix.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + peeringName, + registeredPrefixName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + registeredPrefix, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates a new registered prefix with the specified name under the given subscription, resource group and peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @param registeredPrefix The properties needed to create a registered prefix. + * @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 customer's prefix that is registered by the peering service provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String peeringName, + String registeredPrefixName, + PeeringRegisteredPrefixInner registeredPrefix, + 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 (registeredPrefixName == null) { + return Mono + .error(new IllegalArgumentException("Parameter registeredPrefixName 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 (registeredPrefix == null) { + return Mono + .error(new IllegalArgumentException("Parameter registeredPrefix is required and cannot be null.")); + } else { + registeredPrefix.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + peeringName, + registeredPrefixName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + registeredPrefix, + accept, + context); + } + + /** + * Creates a new registered prefix with the specified name under the given subscription, resource group and peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @param registeredPrefix The properties needed to create a registered prefix. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the customer's prefix that is registered by the peering service provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String peeringName, + String registeredPrefixName, + PeeringRegisteredPrefixInner registeredPrefix) { + return createOrUpdateWithResponseAsync(resourceGroupName, peeringName, registeredPrefixName, registeredPrefix) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates a new registered prefix with the specified name under the given subscription, resource group and peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @param registeredPrefix The properties needed to create a registered prefix. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the customer's prefix that is registered by the peering service provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PeeringRegisteredPrefixInner createOrUpdate( + String resourceGroupName, + String peeringName, + String registeredPrefixName, + PeeringRegisteredPrefixInner registeredPrefix) { + return createOrUpdateAsync(resourceGroupName, peeringName, registeredPrefixName, registeredPrefix).block(); + } + + /** + * Creates a new registered prefix with the specified name under the given subscription, resource group and peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @param registeredPrefix The properties needed to create a registered prefix. + * @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 customer's prefix that is registered by the peering service provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String peeringName, + String registeredPrefixName, + PeeringRegisteredPrefixInner registeredPrefix, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, peeringName, registeredPrefixName, registeredPrefix, context) + .block(); + } + + /** + * Deletes an existing registered prefix with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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, String registeredPrefixName) { + 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 (registeredPrefixName == null) { + return Mono + .error(new IllegalArgumentException("Parameter registeredPrefixName 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, + registeredPrefixName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an existing registered prefix with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @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, String registeredPrefixName, 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 (registeredPrefixName == null) { + return Mono + .error(new IllegalArgumentException("Parameter registeredPrefixName 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, + registeredPrefixName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes an existing registered prefix with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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, String registeredPrefixName) { + return deleteWithResponseAsync(resourceGroupName, peeringName, registeredPrefixName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes an existing registered prefix with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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, String registeredPrefixName) { + deleteAsync(resourceGroupName, peeringName, registeredPrefixName).block(); + } + + /** + * Deletes an existing registered prefix with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @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, String registeredPrefixName, Context context) { + return deleteWithResponseAsync(resourceGroupName, peeringName, registeredPrefixName, context).block(); + } + + /** + * Lists all registered prefixes under the given subscription, resource group and peering. + * + * @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 paginated list of peering registered prefixes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPeeringSinglePageAsync( + 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 + .listByPeering( + this.client.getEndpoint(), + resourceGroupName, + peeringName, + 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists all registered prefixes under the given subscription, resource group and peering. + * + * @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 paginated list of peering registered prefixes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPeeringSinglePageAsync( + 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 + .listByPeering( + this.client.getEndpoint(), + resourceGroupName, + peeringName, + 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 registered prefixes under the given subscription, resource group and peering. + * + * @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 paginated list of peering registered prefixes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByPeeringAsync(String resourceGroupName, String peeringName) { + return new PagedFlux<>( + () -> listByPeeringSinglePageAsync(resourceGroupName, peeringName), + nextLink -> listByPeeringNextSinglePageAsync(nextLink)); + } + + /** + * Lists all registered prefixes under the given subscription, resource group and peering. + * + * @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 paginated list of peering registered prefixes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByPeeringAsync( + String resourceGroupName, String peeringName, Context context) { + return new PagedFlux<>( + () -> listByPeeringSinglePageAsync(resourceGroupName, peeringName, context), + nextLink -> listByPeeringNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all registered prefixes under the given subscription, resource group and peering. + * + * @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 paginated list of peering registered prefixes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByPeering(String resourceGroupName, String peeringName) { + return new PagedIterable<>(listByPeeringAsync(resourceGroupName, peeringName)); + } + + /** + * Lists all registered prefixes under the given subscription, resource group and peering. + * + * @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 paginated list of peering registered prefixes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByPeering( + String resourceGroupName, String peeringName, Context context) { + return new PagedIterable<>(listByPeeringAsync(resourceGroupName, peeringName, 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 registered prefixes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPeeringNextSinglePageAsync(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.listByPeeringNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 registered prefixes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPeeringNextSinglePageAsync( + 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 + .listByPeeringNext(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/RegisteredPrefixesImpl.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/RegisteredPrefixesImpl.java new file mode 100644 index 000000000000..e90383afcdf2 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/RegisteredPrefixesImpl.java @@ -0,0 +1,201 @@ +// 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.PeeringManager; +import com.azure.resourcemanager.peering.fluent.RegisteredPrefixesClient; +import com.azure.resourcemanager.peering.fluent.models.PeeringRegisteredPrefixInner; +import com.azure.resourcemanager.peering.models.PeeringRegisteredPrefix; +import com.azure.resourcemanager.peering.models.RegisteredPrefixes; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RegisteredPrefixesImpl implements RegisteredPrefixes { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegisteredPrefixesImpl.class); + + private final RegisteredPrefixesClient innerClient; + + private final PeeringManager serviceManager; + + public RegisteredPrefixesImpl(RegisteredPrefixesClient innerClient, PeeringManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PeeringRegisteredPrefix get(String resourceGroupName, String peeringName, String registeredPrefixName) { + PeeringRegisteredPrefixInner inner = + this.serviceClient().get(resourceGroupName, peeringName, registeredPrefixName); + if (inner != null) { + return new PeeringRegisteredPrefixImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String peeringName, String registeredPrefixName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, peeringName, registeredPrefixName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PeeringRegisteredPrefixImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String peeringName, String registeredPrefixName) { + this.serviceClient().delete(resourceGroupName, peeringName, registeredPrefixName); + } + + public Response deleteWithResponse( + String resourceGroupName, String peeringName, String registeredPrefixName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, peeringName, registeredPrefixName, context); + } + + public PagedIterable listByPeering(String resourceGroupName, String peeringName) { + PagedIterable inner = + this.serviceClient().listByPeering(resourceGroupName, peeringName); + return Utils.mapPage(inner, inner1 -> new PeeringRegisteredPrefixImpl(inner1, this.manager())); + } + + public PagedIterable listByPeering( + String resourceGroupName, String peeringName, Context context) { + PagedIterable inner = + this.serviceClient().listByPeering(resourceGroupName, peeringName, context); + return Utils.mapPage(inner, inner1 -> new PeeringRegisteredPrefixImpl(inner1, this.manager())); + } + + public PeeringRegisteredPrefix 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))); + } + String registeredPrefixName = Utils.getValueFromIdByName(id, "registeredPrefixes"); + if (registeredPrefixName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'registeredPrefixes'.", id))); + } + return this.getWithResponse(resourceGroupName, peeringName, registeredPrefixName, 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))); + } + String registeredPrefixName = Utils.getValueFromIdByName(id, "registeredPrefixes"); + if (registeredPrefixName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'registeredPrefixes'.", id))); + } + return this.getWithResponse(resourceGroupName, peeringName, registeredPrefixName, 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))); + } + String registeredPrefixName = Utils.getValueFromIdByName(id, "registeredPrefixes"); + if (registeredPrefixName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'registeredPrefixes'.", id))); + } + this.deleteWithResponse(resourceGroupName, peeringName, registeredPrefixName, 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))); + } + String registeredPrefixName = Utils.getValueFromIdByName(id, "registeredPrefixes"); + if (registeredPrefixName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'registeredPrefixes'.", id))); + } + return this.deleteWithResponse(resourceGroupName, peeringName, registeredPrefixName, context); + } + + private RegisteredPrefixesClient serviceClient() { + return this.innerClient; + } + + private PeeringManager manager() { + return this.serviceManager; + } + + public PeeringRegisteredPrefixImpl define(String name) { + return new PeeringRegisteredPrefixImpl(name, this.manager()); + } +} 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..c7454785102f --- /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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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..cc1ac51ff8f2 --- /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.PeeringManager; +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 PeeringManager serviceManager; + + public ResourceProvidersImpl(ResourceProvidersClient innerClient, 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 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..0c386f95fd03 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/implementation/Utils.java @@ -0,0 +1,196 @@ +// 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.Mono; + +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 pageIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pageIterable, Function mapper) { + super(new PagedFlux(Mono::empty)); + this.pageIterable = pageIterable; + this.mapper = mapper; + this.pageMapper = + 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 pageIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pageIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pageIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pageIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pageIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pageIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pageIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pageIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pageIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pageIterable.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..e285cc76f142 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/BgpSession.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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") + private String microsoftSessionIPv4Address; + + /* + * The IPv6 session address on Microsoft's end. + */ + @JsonProperty(value = "microsoftSessionIPv6Address") + 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; + } + + /** + * Set the microsoftSessionIPv4Address property: The IPv4 session address on Microsoft's end. + * + * @param microsoftSessionIPv4Address the microsoftSessionIPv4Address value to set. + * @return the BgpSession object itself. + */ + public BgpSession withMicrosoftSessionIPv4Address(String microsoftSessionIPv4Address) { + this.microsoftSessionIPv4Address = microsoftSessionIPv4Address; + return this; + } + + /** + * Get the microsoftSessionIPv6Address property: The IPv6 session address on Microsoft's end. + * + * @return the microsoftSessionIPv6Address value. + */ + public String microsoftSessionIPv6Address() { + return this.microsoftSessionIPv6Address; + } + + /** + * Set the microsoftSessionIPv6Address property: The IPv6 session address on Microsoft's end. + * + * @param microsoftSessionIPv6Address the microsoftSessionIPv6Address value to set. + * @return the BgpSession object itself. + */ + public BgpSession withMicrosoftSessionIPv6Address(String microsoftSessionIPv6Address) { + this.microsoftSessionIPv6Address = microsoftSessionIPv6Address; + return this; + } + + /** + * 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/CdnPeeringPrefix.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/CdnPeeringPrefix.java new file mode 100644 index 000000000000..f4484b34911b --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/CdnPeeringPrefix.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.models; + +import com.azure.resourcemanager.peering.fluent.models.CdnPeeringPrefixInner; + +/** An immutable client-side representation of CdnPeeringPrefix. */ +public interface CdnPeeringPrefix { + /** + * 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: The prefix. + * + * @return the prefix value. + */ + String prefix(); + + /** + * Gets the azureRegion property: The Azure region. + * + * @return the azureRegion value. + */ + String azureRegion(); + + /** + * Gets the azureService property: The Azure service. + * + * @return the azureService value. + */ + String azureService(); + + /** + * Gets the isPrimaryRegion property: The flag that indicates whether or not this is the primary region. + * + * @return the isPrimaryRegion value. + */ + Boolean isPrimaryRegion(); + + /** + * Gets the bgpCommunity property: The BGP Community. + * + * @return the bgpCommunity value. + */ + String bgpCommunity(); + + /** + * Gets the inner com.azure.resourcemanager.peering.fluent.models.CdnPeeringPrefixInner object. + * + * @return the inner object. + */ + CdnPeeringPrefixInner innerModel(); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/CdnPeeringPrefixListResult.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/CdnPeeringPrefixListResult.java new file mode 100644 index 000000000000..59289b141a5f --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/CdnPeeringPrefixListResult.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.CdnPeeringPrefixInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The paginated list of CDN peering prefixes. */ +@Fluent +public final class CdnPeeringPrefixListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CdnPeeringPrefixListResult.class); + + /* + * The list of CDN peering prefixes. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link to fetch the next page of CDN peering prefixes. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of CDN peering prefixes. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of CDN peering prefixes. + * + * @param value the value value to set. + * @return the CdnPeeringPrefixListResult object itself. + */ + public CdnPeeringPrefixListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to fetch the next page of CDN peering prefixes. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to fetch the next page of CDN peering prefixes. + * + * @param nextLink the nextLink value to set. + * @return the CdnPeeringPrefixListResult object itself. + */ + public CdnPeeringPrefixListResult 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/CdnPeeringPrefixes.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/CdnPeeringPrefixes.java new file mode 100644 index 000000000000..b2162b04bbbb --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/CdnPeeringPrefixes.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.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of CdnPeeringPrefixes. */ +public interface CdnPeeringPrefixes { + /** + * Lists all of the advertised prefixes for the specified peering location. + * + * @param peeringLocation The peering location. + * @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 CDN peering prefixes. + */ + PagedIterable list(String peeringLocation); + + /** + * Lists all of the advertised prefixes for the specified peering location. + * + * @param peeringLocation The peering location. + * @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 CDN peering prefixes. + */ + PagedIterable list(String peeringLocation, Context context); +} 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..8d3a2daae988 --- /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 peering service location. + */ + @JsonProperty(value = "peeringServiceLocation") + private String peeringServiceLocation; + + /* + * Gets or sets the peering service provider. + */ + @JsonProperty(value = "peeringServiceProvider") + private String peeringServiceProvider; + + /** + * Get the peeringServiceLocation property: Gets or sets the peering service location. + * + * @return the peeringServiceLocation value. + */ + public String peeringServiceLocation() { + return this.peeringServiceLocation; + } + + /** + * Set the peeringServiceLocation property: Gets or sets the peering service location. + * + * @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 peering service provider. + * + * @return the peeringServiceProvider value. + */ + public String peeringServiceProvider() { + return this.peeringServiceProvider; + } + + /** + * Set the peeringServiceProvider property: Gets or sets the peering service provider. + * + * @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/ContactDetail.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ContactDetail.java new file mode 100644 index 000000000000..73276b13ba43 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ContactDetail.java @@ -0,0 +1,102 @@ +// 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 contact detail class. */ +@Fluent +public final class ContactDetail { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContactDetail.class); + + /* + * The role of the contact. + */ + @JsonProperty(value = "role") + private Role role; + + /* + * The e-mail address of the contact. + */ + @JsonProperty(value = "email") + private String email; + + /* + * The phone number of the contact. + */ + @JsonProperty(value = "phone") + private String phone; + + /** + * Get the role property: The role of the contact. + * + * @return the role value. + */ + public Role role() { + return this.role; + } + + /** + * Set the role property: The role of the contact. + * + * @param role the role value to set. + * @return the ContactDetail object itself. + */ + public ContactDetail withRole(Role role) { + this.role = role; + return this; + } + + /** + * Get the email property: The e-mail address of the contact. + * + * @return the email value. + */ + public String email() { + return this.email; + } + + /** + * Set the email property: The e-mail address of the contact. + * + * @param email the email value to set. + * @return the ContactDetail object itself. + */ + public ContactDetail withEmail(String email) { + this.email = email; + return this; + } + + /** + * Get the phone property: The phone number of the contact. + * + * @return the phone value. + */ + public String phone() { + return this.phone; + } + + /** + * Set the phone property: The phone number of the contact. + * + * @param phone the phone value to set. + * @return the ContactDetail object itself. + */ + public ContactDetail withPhone(String 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..f1525cab182d --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/DirectConnection.java @@ -0,0 +1,251 @@ +// 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", access = JsonProperty.Access.WRITE_ONLY) + 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 ID used within Microsoft's peering provisioning system to track the + * connection + */ + @JsonProperty(value = "microsoftTrackingId", access = JsonProperty.Access.WRITE_ONLY) + private String microsoftTrackingId; + + /* + * 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; + + /* + * The error message related to the connection state, if any. + */ + @JsonProperty(value = "errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /** + * 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; + } + + /** + * 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 microsoftTrackingId property: The ID used within Microsoft's peering provisioning system to track the + * connection. + * + * @return the microsoftTrackingId value. + */ + public String microsoftTrackingId() { + return this.microsoftTrackingId; + } + + /** + * 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; + } + + /** + * Get the errorMessage property: The error message related to the connection state, if any. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * 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..f919a586d09e --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/DirectPeeringType.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 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"); + + /** Static value Ix for DirectPeeringType. */ + public static final DirectPeeringType IX = fromString("Ix"); + + /** Static value IxRs for DirectPeeringType. */ + public static final DirectPeeringType IX_RS = fromString("IxRs"); + + /** + * 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..76c73910ecd8 --- /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 UNAVAILABLE = 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..a0fd9eca4f84 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ExchangeConnection.java @@ -0,0 +1,138 @@ +// 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; + + /* + * The error message related to the connection state, if any. + */ + @JsonProperty(value = "errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /** + * 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; + } + + /** + * Get the errorMessage property: The error message related to the connection state, if any. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * 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..a80433c8327d --- /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 ViaServiceProvider for LearnedType. */ + public static final LearnedType VIA_SERVICE_PROVIDER = fromString("ViaServiceProvider"); + + /** 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..f41687314042 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/LegacyPeerings.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 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 asn The ASN number associated with a legacy 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, Integer asn, 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/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..7f376692e5d8 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeerAsn.java @@ -0,0 +1,234 @@ +// 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; +import java.util.List; + +/** 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 peerContactDetail property: The contact details of the peer. + * + * @return the peerContactDetail value. + */ + List peerContactDetail(); + + /** + * 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 errorMessage property: The error message for the validation state. + * + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * 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.WithPeerContactDetail, + 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 peerContactDetail. */ + interface WithPeerContactDetail { + /** + * Specifies the peerContactDetail property: The contact details of the peer.. + * + * @param peerContactDetail The contact details of the peer. + * @return the next definition stage. + */ + WithCreate withPeerContactDetail(List peerContactDetail); + } + /** 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.WithPeerContactDetail, + 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 peerContactDetail. */ + interface WithPeerContactDetail { + /** + * Specifies the peerContactDetail property: The contact details of the peer.. + * + * @param peerContactDetail The contact details of the peer. + * @return the next definition stage. + */ + Update withPeerContactDetail(List peerContactDetail); + } + /** 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..69a0bb7b0010 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringLocationsDirectPeeringType.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 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"); + + /** Static value Ix for PeeringLocationsDirectPeeringType. */ + public static final PeeringLocationsDirectPeeringType IX = fromString("Ix"); + + /** Static value IxRs for PeeringLocationsDirectPeeringType. */ + public static final PeeringLocationsDirectPeeringType IX_RS = fromString("IxRs"); + + /** + * 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..eb302c8bdbfc --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringPropertiesDirect.java @@ -0,0 +1,124 @@ +// 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", access = JsonProperty.Access.WRITE_ONLY) + 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; + } + + /** + * 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/PeeringReceivedRoute.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringReceivedRoute.java new file mode 100644 index 000000000000..614fc0452819 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringReceivedRoute.java @@ -0,0 +1,68 @@ +// 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.PeeringReceivedRouteInner; + +/** An immutable client-side representation of PeeringReceivedRoute. */ +public interface PeeringReceivedRoute { + /** + * Gets the prefix property: The prefix. + * + * @return the prefix value. + */ + String prefix(); + + /** + * Gets the nextHop property: The next hop for the prefix. + * + * @return the nextHop value. + */ + String nextHop(); + + /** + * Gets the asPath property: The AS path for the prefix. + * + * @return the asPath value. + */ + String asPath(); + + /** + * Gets the originAsValidationState property: The origin AS change information for the prefix. + * + * @return the originAsValidationState value. + */ + String originAsValidationState(); + + /** + * Gets the rpkiValidationState property: The RPKI validation state for the prefix and origin AS that's listed in + * the AS path. + * + * @return the rpkiValidationState value. + */ + String rpkiValidationState(); + + /** + * Gets the trustAnchor property: The authority which holds the Route Origin Authorization record for the prefix, if + * any. + * + * @return the trustAnchor value. + */ + String trustAnchor(); + + /** + * Gets the receivedTimestamp property: The received timestamp associated with the prefix. + * + * @return the receivedTimestamp value. + */ + String receivedTimestamp(); + + /** + * Gets the inner com.azure.resourcemanager.peering.fluent.models.PeeringReceivedRouteInner object. + * + * @return the inner object. + */ + PeeringReceivedRouteInner innerModel(); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringReceivedRouteListResult.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringReceivedRouteListResult.java new file mode 100644 index 000000000000..1b1b4fbecce8 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringReceivedRouteListResult.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.PeeringReceivedRouteInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The paginated list of received routes for the peering. */ +@Fluent +public final class PeeringReceivedRouteListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringReceivedRouteListResult.class); + + /* + * The list of received routes for the peering. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link to fetch the next page of received routes for the peering. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of received routes for the peering. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of received routes for the peering. + * + * @param value the value value to set. + * @return the PeeringReceivedRouteListResult object itself. + */ + public PeeringReceivedRouteListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to fetch the next page of received routes for the peering. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to fetch the next page of received routes for the peering. + * + * @param nextLink the nextLink value to set. + * @return the PeeringReceivedRouteListResult object itself. + */ + public PeeringReceivedRouteListResult 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/PeeringRegisteredAsn.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringRegisteredAsn.java new file mode 100644 index 000000000000..fe1a0fab361a --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringRegisteredAsn.java @@ -0,0 +1,163 @@ +// 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.PeeringRegisteredAsnInner; + +/** An immutable client-side representation of PeeringRegisteredAsn. */ +public interface PeeringRegisteredAsn { + /** + * 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 asn property: The customer's ASN from which traffic originates. + * + * @return the asn value. + */ + Integer asn(); + + /** + * Gets the peeringServicePrefixKey property: The peering service prefix key that is to be shared with the customer. + * + * @return the peeringServicePrefixKey value. + */ + String peeringServicePrefixKey(); + + /** + * 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.PeeringRegisteredAsnInner object. + * + * @return the inner object. + */ + PeeringRegisteredAsnInner innerModel(); + + /** The entirety of the PeeringRegisteredAsn definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The PeeringRegisteredAsn definition stages. */ + interface DefinitionStages { + /** The first stage of the PeeringRegisteredAsn definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the PeeringRegisteredAsn definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, peeringName. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @return the next definition stage. + */ + WithCreate withExistingPeering(String resourceGroupName, String peeringName); + } + /** + * The stage of the PeeringRegisteredAsn 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.WithAsn { + /** + * Executes the create request. + * + * @return the created resource. + */ + PeeringRegisteredAsn create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PeeringRegisteredAsn create(Context context); + } + /** The stage of the PeeringRegisteredAsn definition allowing to specify asn. */ + interface WithAsn { + /** + * Specifies the asn property: The customer's ASN from which traffic originates.. + * + * @param asn The customer's ASN from which traffic originates. + * @return the next definition stage. + */ + WithCreate withAsn(Integer asn); + } + } + /** + * Begins update for the PeeringRegisteredAsn resource. + * + * @return the stage of resource update. + */ + PeeringRegisteredAsn.Update update(); + + /** The template for PeeringRegisteredAsn update. */ + interface Update extends UpdateStages.WithAsn { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PeeringRegisteredAsn apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PeeringRegisteredAsn apply(Context context); + } + /** The PeeringRegisteredAsn update stages. */ + interface UpdateStages { + /** The stage of the PeeringRegisteredAsn update allowing to specify asn. */ + interface WithAsn { + /** + * Specifies the asn property: The customer's ASN from which traffic originates.. + * + * @param asn The customer's ASN from which traffic originates. + * @return the next definition stage. + */ + Update withAsn(Integer asn); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PeeringRegisteredAsn refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PeeringRegisteredAsn refresh(Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringRegisteredAsnListResult.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringRegisteredAsnListResult.java new file mode 100644 index 000000000000..eb41f52b5d86 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringRegisteredAsnListResult.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.PeeringRegisteredAsnInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The paginated list of peering registered ASNs. */ +@Fluent +public final class PeeringRegisteredAsnListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringRegisteredAsnListResult.class); + + /* + * The list of peering registered ASNs. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link to fetch the next page of peering registered ASNs. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of peering registered ASNs. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of peering registered ASNs. + * + * @param value the value value to set. + * @return the PeeringRegisteredAsnListResult object itself. + */ + public PeeringRegisteredAsnListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to fetch the next page of peering registered ASNs. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to fetch the next page of peering registered ASNs. + * + * @param nextLink the nextLink value to set. + * @return the PeeringRegisteredAsnListResult object itself. + */ + public PeeringRegisteredAsnListResult 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/PeeringRegisteredPrefix.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringRegisteredPrefix.java new file mode 100644 index 000000000000..bd2aaebc8bf1 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringRegisteredPrefix.java @@ -0,0 +1,177 @@ +// 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.PeeringRegisteredPrefixInner; + +/** An immutable client-side representation of PeeringRegisteredPrefix. */ +public interface PeeringRegisteredPrefix { + /** + * 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: The customer's prefix from which traffic originates. + * + * @return the prefix value. + */ + String prefix(); + + /** + * Gets the prefixValidationState property: The prefix validation state. + * + * @return the prefixValidationState value. + */ + PrefixValidationState prefixValidationState(); + + /** + * Gets the peeringServicePrefixKey property: The peering service prefix key that is to be shared with the customer. + * + * @return the peeringServicePrefixKey value. + */ + String peeringServicePrefixKey(); + + /** + * Gets the errorMessage property: The error message associated with the validation state, if any. + * + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * 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.PeeringRegisteredPrefixInner object. + * + * @return the inner object. + */ + PeeringRegisteredPrefixInner innerModel(); + + /** The entirety of the PeeringRegisteredPrefix definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The PeeringRegisteredPrefix definition stages. */ + interface DefinitionStages { + /** The first stage of the PeeringRegisteredPrefix definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the PeeringRegisteredPrefix definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, peeringName. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @return the next definition stage. + */ + WithCreate withExistingPeering(String resourceGroupName, String peeringName); + } + /** + * The stage of the PeeringRegisteredPrefix 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 { + /** + * Executes the create request. + * + * @return the created resource. + */ + PeeringRegisteredPrefix create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PeeringRegisteredPrefix create(Context context); + } + /** The stage of the PeeringRegisteredPrefix definition allowing to specify prefix. */ + interface WithPrefix { + /** + * Specifies the prefix property: The customer's prefix from which traffic originates.. + * + * @param prefix The customer's prefix from which traffic originates. + * @return the next definition stage. + */ + WithCreate withPrefix(String prefix); + } + } + /** + * Begins update for the PeeringRegisteredPrefix resource. + * + * @return the stage of resource update. + */ + PeeringRegisteredPrefix.Update update(); + + /** The template for PeeringRegisteredPrefix update. */ + interface Update extends UpdateStages.WithPrefix { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PeeringRegisteredPrefix apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PeeringRegisteredPrefix apply(Context context); + } + /** The PeeringRegisteredPrefix update stages. */ + interface UpdateStages { + /** The stage of the PeeringRegisteredPrefix update allowing to specify prefix. */ + interface WithPrefix { + /** + * Specifies the prefix property: The customer's prefix from which traffic originates.. + * + * @param prefix The customer's prefix from which traffic originates. + * @return the next definition stage. + */ + Update withPrefix(String prefix); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PeeringRegisteredPrefix refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PeeringRegisteredPrefix refresh(Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringRegisteredPrefixListResult.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringRegisteredPrefixListResult.java new file mode 100644 index 000000000000..01e646f232ed --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringRegisteredPrefixListResult.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.PeeringRegisteredPrefixInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The paginated list of peering registered prefixes. */ +@Fluent +public final class PeeringRegisteredPrefixListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringRegisteredPrefixListResult.class); + + /* + * The list of peering registered prefixes. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link to fetch the next page of peering registered prefixes. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of peering registered prefixes. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of peering registered prefixes. + * + * @param value the value value to set. + * @return the PeeringRegisteredPrefixListResult object itself. + */ + public PeeringRegisteredPrefixListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to fetch the next page of peering registered prefixes. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to fetch the next page of peering registered prefixes. + * + * @param nextLink the nextLink value to set. + * @return the PeeringRegisteredPrefixListResult object itself. + */ + public PeeringRegisteredPrefixListResult 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/PeeringService.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringService.java new file mode 100644 index 000000000000..672b02e966d0 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringService.java @@ -0,0 +1,296 @@ +// 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 sku property: The SKU that defines the type of the peering service. + * + * @return the sku value. + */ + PeeringServiceSku sku(); + + /** + * 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 location (state/province) of the customer. + * + * @return the peeringServiceLocation value. + */ + String peeringServiceLocation(); + + /** + * Gets the peeringServiceProvider property: The name of the service provider. + * + * @return the peeringServiceProvider value. + */ + String peeringServiceProvider(); + + /** + * Gets the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the providerPrimaryPeeringLocation property: The primary peering (Microsoft/service provider) location to be + * used for customer traffic. + * + * @return the providerPrimaryPeeringLocation value. + */ + String providerPrimaryPeeringLocation(); + + /** + * Gets the providerBackupPeeringLocation property: The backup peering (Microsoft/service provider) location to be + * used for customer traffic. + * + * @return the providerBackupPeeringLocation value. + */ + String providerBackupPeeringLocation(); + + /** + * 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.WithSku, + DefinitionStages.WithPeeringServiceLocation, + DefinitionStages.WithPeeringServiceProvider, + DefinitionStages.WithProviderPrimaryPeeringLocation, + DefinitionStages.WithProviderBackupPeeringLocation { + /** + * 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 sku. */ + interface WithSku { + /** + * Specifies the sku property: The SKU that defines the type of the peering service.. + * + * @param sku The SKU that defines the type of the peering service. + * @return the next definition stage. + */ + WithCreate withSku(PeeringServiceSku sku); + } + /** The stage of the PeeringService definition allowing to specify peeringServiceLocation. */ + interface WithPeeringServiceLocation { + /** + * Specifies the peeringServiceLocation property: The location (state/province) of the customer.. + * + * @param peeringServiceLocation The location (state/province) 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 name of the service provider.. + * + * @param peeringServiceProvider The name of the service provider. + * @return the next definition stage. + */ + WithCreate withPeeringServiceProvider(String peeringServiceProvider); + } + /** The stage of the PeeringService definition allowing to specify providerPrimaryPeeringLocation. */ + interface WithProviderPrimaryPeeringLocation { + /** + * Specifies the providerPrimaryPeeringLocation property: The primary peering (Microsoft/service provider) + * location to be used for customer traffic.. + * + * @param providerPrimaryPeeringLocation The primary peering (Microsoft/service provider) location to be + * used for customer traffic. + * @return the next definition stage. + */ + WithCreate withProviderPrimaryPeeringLocation(String providerPrimaryPeeringLocation); + } + /** The stage of the PeeringService definition allowing to specify providerBackupPeeringLocation. */ + interface WithProviderBackupPeeringLocation { + /** + * Specifies the providerBackupPeeringLocation property: The backup peering (Microsoft/service provider) + * location to be used for customer traffic.. + * + * @param providerBackupPeeringLocation The backup peering (Microsoft/service provider) location to be used + * for customer traffic. + * @return the next definition stage. + */ + WithCreate withProviderBackupPeeringLocation(String providerBackupPeeringLocation); + } + } + /** + * 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/PeeringServiceCountries.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceCountries.java new file mode 100644 index 000000000000..651032021f1f --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceCountries.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.Resource; +import com.azure.core.util.Context; + +/** Resource collection API of PeeringServiceCountries. */ +public interface PeeringServiceCountries { + /** + * Lists all of the available countries for peering service. + * + * @throws com.azure.core.management.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 countries. + */ + PagedIterable list(); + + /** + * Lists all of the available countries for 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 paginated list of peering service countries. + */ + PagedIterable list(Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceCountryListResult.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceCountryListResult.java new file mode 100644 index 000000000000..9313584cfddb --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceCountryListResult.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.peering.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The paginated list of peering service countries. */ +@Fluent +public final class PeeringServiceCountryListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringServiceCountryListResult.class); + + /* + * The list of peering service countries. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link to fetch the next page of peering service countries. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of peering service countries. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of peering service countries. + * + * @param value the value value to set. + * @return the PeeringServiceCountryListResult object itself. + */ + public PeeringServiceCountryListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to fetch the next page of peering service countries. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to fetch the next page of peering service countries. + * + * @param nextLink the nextLink value to set. + * @return the PeeringServiceCountryListResult object itself. + */ + public PeeringServiceCountryListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + 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/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..d56158e7fa02 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceLocations.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 locations for peering service. + * + * @throws com.azure.core.management.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 locations for peering service. + * + * @param country The country of interest, in which the locations are to be present. + * @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(String country, 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..e61d63a8dfad --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServicePrefix.java @@ -0,0 +1,212 @@ +// 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; +import java.util.List; + +/** 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: The prefix from which your traffic originates. + * + * @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 errorMessage property: The error message for validation state. + * + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * Gets the events property: The list of events for peering service prefix. + * + * @return the events value. + */ + List events(); + + /** + * Gets the peeringServicePrefixKey property: The peering service prefix key. + * + * @return the peeringServicePrefixKey value. + */ + String peeringServicePrefixKey(); + + /** + * 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 name of the resource group. + * @param peeringServiceName The name of the peering service. + * @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.WithPeeringServicePrefixKey { + /** + * 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: The prefix from which your traffic originates.. + * + * @param prefix The prefix from which your traffic originates. + * @return the next definition stage. + */ + WithCreate withPrefix(String prefix); + } + /** The stage of the PeeringServicePrefix definition allowing to specify peeringServicePrefixKey. */ + interface WithPeeringServicePrefixKey { + /** + * Specifies the peeringServicePrefixKey property: The peering service prefix key. + * + * @param peeringServicePrefixKey The peering service prefix key. + * @return the next definition stage. + */ + WithCreate withPeeringServicePrefixKey(String peeringServicePrefixKey); + } + } + /** + * 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.WithPeeringServicePrefixKey { + /** + * 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: The prefix from which your traffic originates.. + * + * @param prefix The prefix from which your traffic originates. + * @return the next definition stage. + */ + Update withPrefix(String prefix); + } + /** The stage of the PeeringServicePrefix update allowing to specify peeringServicePrefixKey. */ + interface WithPeeringServicePrefixKey { + /** + * Specifies the peeringServicePrefixKey property: The peering service prefix key. + * + * @param peeringServicePrefixKey The peering service prefix key. + * @return the next definition stage. + */ + Update withPeeringServicePrefixKey(String peeringServicePrefixKey); + } + } + /** + * 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/PeeringServicePrefixEvent.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServicePrefixEvent.java new file mode 100644 index 000000000000..6c5ea697a8c8 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServicePrefixEvent.java @@ -0,0 +1,100 @@ +// 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; +import java.time.OffsetDateTime; + +/** The details of the event associated with a prefix. */ +@Immutable +public final class PeeringServicePrefixEvent { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringServicePrefixEvent.class); + + /* + * The timestamp of the event associated with a prefix. + */ + @JsonProperty(value = "eventTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime eventTimestamp; + + /* + * The type of the event associated with a prefix. + */ + @JsonProperty(value = "eventType", access = JsonProperty.Access.WRITE_ONLY) + private String eventType; + + /* + * The summary of the event associated with a prefix. + */ + @JsonProperty(value = "eventSummary", access = JsonProperty.Access.WRITE_ONLY) + private String eventSummary; + + /* + * The level of the event associated with a prefix. + */ + @JsonProperty(value = "eventLevel", access = JsonProperty.Access.WRITE_ONLY) + private String eventLevel; + + /* + * The description of the event associated with a prefix. + */ + @JsonProperty(value = "eventDescription", access = JsonProperty.Access.WRITE_ONLY) + private String eventDescription; + + /** + * Get the eventTimestamp property: The timestamp of the event associated with a prefix. + * + * @return the eventTimestamp value. + */ + public OffsetDateTime eventTimestamp() { + return this.eventTimestamp; + } + + /** + * Get the eventType property: The type of the event associated with a prefix. + * + * @return the eventType value. + */ + public String eventType() { + return this.eventType; + } + + /** + * Get the eventSummary property: The summary of the event associated with a prefix. + * + * @return the eventSummary value. + */ + public String eventSummary() { + return this.eventSummary; + } + + /** + * Get the eventLevel property: The level of the event associated with a prefix. + * + * @return the eventLevel value. + */ + public String eventLevel() { + return this.eventLevel; + } + + /** + * Get the eventDescription property: The description of the event associated with a prefix. + * + * @return the eventDescription value. + */ + public String eventDescription() { + return this.eventDescription; + } + + /** + * 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/PeeringServicePrefixListResult.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServicePrefixListResult.java new file mode 100644 index 000000000000..c425a81c843a --- /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 peering service prefixes. */ +@Fluent +public final class PeeringServicePrefixListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringServicePrefixListResult.class); + + /* + * The list of peering service prefixes. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link to fetch the next page of peering service prefixes. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of peering service prefixes. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of peering service prefixes. + * + * @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 peering service prefixes. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to fetch the next page of peering service prefixes. + * + * @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/PeeringServiceProvider.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceProvider.java new file mode 100644 index 000000000000..abc85321595c --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceProvider.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.models; + +import com.azure.resourcemanager.peering.fluent.models.PeeringServiceProviderInner; +import java.util.List; + +/** 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 peeringLocations property: The list of locations at which the service provider peers with Microsoft. + * + * @return the peeringLocations value. + */ + List peeringLocations(); + + /** + * 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/PeeringServiceSku.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceSku.java new file mode 100644 index 000000000000..5330d6be5d90 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PeeringServiceSku.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 type of the peering service. */ +@Fluent +public final class PeeringServiceSku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PeeringServiceSku.class); + + /* + * The name of the peering service SKU. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get the name property: The name of the peering service SKU. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the peering service SKU. + * + * @param name the name value to set. + * @return the PeeringServiceSku object itself. + */ + public PeeringServiceSku withName(String name) { + this.name = name; + 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/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..1abe50536382 --- /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 String 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 String 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(String 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..0d546fb46990 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/PrefixValidationState.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.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 Warning for PrefixValidationState. */ + public static final PrefixValidationState WARNING = fromString("Warning"); + + /** 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..60efd24e0bff --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Prefixes.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 Prefixes. */ +public interface Prefixes { + /** + * Gets an existing prefix with the specified name under the given subscription, resource group and peering service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @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 prefix with the specified name under the given subscription, resource group and peering + * service. + */ + PeeringServicePrefix get(String resourceGroupName, String peeringServiceName, String prefixName); + + /** + * Gets an existing prefix with the specified name under the given subscription, resource group and peering service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @param expand The properties to be expanded. + * @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 prefix with the specified name under the given subscription, resource group and peering + * service. + */ + Response getWithResponse( + String resourceGroupName, String peeringServiceName, String prefixName, String expand, Context context); + + /** + * Deletes an existing prefix with the specified name under the given subscription, resource group and peering + * service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @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); + + /** + * Deletes an existing prefix with the specified name under the given subscription, resource group and peering + * service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param prefixName The name of the prefix. + * @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); + + /** + * Lists all prefixes under the given subscription, resource group and peering service. + * + * @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. + * @return the paginated list of peering service prefixes. + */ + PagedIterable listByPeeringService(String resourceGroupName, String peeringServiceName); + + /** + * Lists all prefixes under the given subscription, resource group and peering service. + * + * @param resourceGroupName The name of the resource group. + * @param peeringServiceName The name of the peering service. + * @param expand The properties to be expanded. + * @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 prefixes. + */ + PagedIterable listByPeeringService( + String resourceGroupName, String peeringServiceName, String expand, Context context); + + /** + * Gets an existing prefix with the specified name under the given subscription, resource group and peering service. + * + * @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 prefix with the specified name under the given subscription, resource group and peering + * service. + */ + PeeringServicePrefix getById(String id); + + /** + * Gets an existing prefix with the specified name under the given subscription, resource group and peering service. + * + * @param id the resource ID. + * @param expand The properties to be expanded. + * @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 prefix with the specified name under the given subscription, resource group and peering + * service. + */ + Response getByIdWithResponse(String id, String expand, Context context); + + /** + * Deletes an existing prefix with the specified name under the given subscription, resource group and peering + * service. + * + * @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 prefix with the specified name under the given subscription, resource group and peering + * service. + * + * @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/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/ReceivedRoutes.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ReceivedRoutes.java new file mode 100644 index 000000000000..9389aed4d6c0 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/ReceivedRoutes.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.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ReceivedRoutes. */ +public interface ReceivedRoutes { + /** + * Lists the prefixes received over the specified peering 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 the paginated list of received routes for the peering. + */ + PagedIterable listByPeering(String resourceGroupName, String peeringName); + + /** + * Lists the prefixes received over the specified peering under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param prefix The optional prefix that can be used to filter the routes. + * @param asPath The optional AS path that can be used to filter the routes. + * @param originAsValidationState The optional origin AS validation state that can be used to filter the routes. + * @param rpkiValidationState The optional RPKI validation state that can be used to filter the routes. + * @param skipToken The optional page continuation token that is used in the event of paginated result. + * @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 received routes for the peering. + */ + PagedIterable listByPeering( + String resourceGroupName, + String peeringName, + String prefix, + String asPath, + String originAsValidationState, + String rpkiValidationState, + String skipToken, + Context context); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/RegisteredAsns.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/RegisteredAsns.java new file mode 100644 index 000000000000..10266f355e17 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/RegisteredAsns.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.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 RegisteredAsns. */ +public interface RegisteredAsns { + /** + * Gets an existing registered ASN with the specified name under the given subscription, resource group and peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the registered 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 an existing registered ASN with the specified name under the given subscription, resource group and + * peering. + */ + PeeringRegisteredAsn get(String resourceGroupName, String peeringName, String registeredAsnName); + + /** + * Gets an existing registered ASN with the specified name under the given subscription, resource group and peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the registered 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 an existing registered ASN with the specified name under the given subscription, resource group and + * peering. + */ + Response getWithResponse( + String resourceGroupName, String peeringName, String registeredAsnName, Context context); + + /** + * Deletes an existing registered ASN with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the registered 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. + */ + void delete(String resourceGroupName, String peeringName, String registeredAsnName); + + /** + * Deletes an existing registered ASN with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredAsnName The name of the registered 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 response. + */ + Response deleteWithResponse( + String resourceGroupName, String peeringName, String registeredAsnName, Context context); + + /** + * Lists all registered ASNs under the given subscription, resource group and peering. + * + * @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 the paginated list of peering registered ASNs. + */ + PagedIterable listByPeering(String resourceGroupName, String peeringName); + + /** + * Lists all registered ASNs under the given subscription, resource group and peering. + * + * @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 paginated list of peering registered ASNs. + */ + PagedIterable listByPeering(String resourceGroupName, String peeringName, Context context); + + /** + * Gets an existing registered ASN with the specified name under the given subscription, resource group and peering. + * + * @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 registered ASN with the specified name under the given subscription, resource group and + * peering. + */ + PeeringRegisteredAsn getById(String id); + + /** + * Gets an existing registered ASN with the specified name under the given subscription, resource group and peering. + * + * @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 registered ASN with the specified name under the given subscription, resource group and + * peering. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an existing registered ASN with the specified name under the given subscription, resource group and + * peering. + * + * @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 registered ASN with the specified name under the given subscription, resource group and + * peering. + * + * @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 PeeringRegisteredAsn resource. + * + * @param name resource name. + * @return the first stage of the new PeeringRegisteredAsn definition. + */ + PeeringRegisteredAsn.DefinitionStages.Blank define(String name); +} diff --git a/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/RegisteredPrefixes.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/RegisteredPrefixes.java new file mode 100644 index 000000000000..3a315626c335 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/RegisteredPrefixes.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 RegisteredPrefixes. */ +public interface RegisteredPrefixes { + /** + * Gets an existing registered prefix with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @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 registered prefix with the specified name under the given subscription, resource group and + * peering. + */ + PeeringRegisteredPrefix get(String resourceGroupName, String peeringName, String registeredPrefixName); + + /** + * Gets an existing registered prefix with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @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 registered prefix with the specified name under the given subscription, resource group and + * peering. + */ + Response getWithResponse( + String resourceGroupName, String peeringName, String registeredPrefixName, Context context); + + /** + * Deletes an existing registered prefix with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @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 peeringName, String registeredPrefixName); + + /** + * Deletes an existing registered prefix with the specified name under the given subscription, resource group and + * peering. + * + * @param resourceGroupName The name of the resource group. + * @param peeringName The name of the peering. + * @param registeredPrefixName The name of the registered prefix. + * @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, String registeredPrefixName, Context context); + + /** + * Lists all registered prefixes under the given subscription, resource group and peering. + * + * @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 the paginated list of peering registered prefixes. + */ + PagedIterable listByPeering(String resourceGroupName, String peeringName); + + /** + * Lists all registered prefixes under the given subscription, resource group and peering. + * + * @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 paginated list of peering registered prefixes. + */ + PagedIterable listByPeering(String resourceGroupName, String peeringName, Context context); + + /** + * Gets an existing registered prefix with the specified name under the given subscription, resource group and + * peering. + * + * @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 registered prefix with the specified name under the given subscription, resource group and + * peering. + */ + PeeringRegisteredPrefix getById(String id); + + /** + * Gets an existing registered prefix with the specified name under the given subscription, resource group and + * peering. + * + * @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 registered prefix with the specified name under the given subscription, resource group and + * peering. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an existing registered prefix with the specified name under the given subscription, resource group and + * peering. + * + * @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 registered prefix with the specified name under the given subscription, resource group and + * peering. + * + * @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 PeeringRegisteredPrefix resource. + * + * @param name resource name. + * @return the first stage of the new PeeringRegisteredPrefix definition. + */ + PeeringRegisteredPrefix.DefinitionStages.Blank define(String name); +} 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/Role.java b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Role.java new file mode 100644 index 000000000000..7bb91ac9ca26 --- /dev/null +++ b/sdk/peering/azure-resourcemanager-peering/src/main/java/com/azure/resourcemanager/peering/models/Role.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 Role. */ +public final class Role extends ExpandableStringEnum { + /** Static value Noc for Role. */ + public static final Role NOC = fromString("Noc"); + + /** Static value Policy for Role. */ + public static final Role POLICY = fromString("Policy"); + + /** Static value Technical for Role. */ + public static final Role TECHNICAL = fromString("Technical"); + + /** Static value Service for Role. */ + public static final Role SERVICE = fromString("Service"); + + /** Static value Escalation for Role. */ + public static final Role ESCALATION = fromString("Escalation"); + + /** Static value Other for Role. */ + public static final Role OTHER = fromString("Other"); + + /** + * Creates or finds a Role from its string representation. + * + * @param name a name to look for. + * @return the corresponding Role. + */ + @JsonCreator + public static Role fromString(String name) { + return fromString(name, Role.class); + } + + /** @return known Role values. */ + public static Collection values() { + return values(Role.class); + } +} 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 + + + +