diff --git a/sdk/peering/mgmt-v2020_04_01/pom.xml b/sdk/peering/mgmt-v2020_04_01/pom.xml new file mode 100644 index 0000000000000..ce88a4e847550 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.peering.v2020_04_01 + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-peering + 1.0.0-beta + jar + Microsoft Azure SDK for Peering Management + This package contains Microsoft Peering Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + 1.6.5 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/BgpSession.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/BgpSession.java new file mode 100644 index 0000000000000..c05dcca55368b --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/BgpSession.java @@ -0,0 +1,285 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties that define a BGP session. + */ +public class BgpSession { + /** + * 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. Possible values include: 'None', 'Idle', + * 'Connect', 'Active', 'OpenSent', 'OpenConfirm', 'OpenReceived', + * 'Established', 'PendingAdd', 'PendingUpdate', 'PendingRemove'. + */ + @JsonProperty(value = "sessionStateV4", access = JsonProperty.Access.WRITE_ONLY) + private SessionStateV4 sessionStateV4; + + /** + * The state of the IPv6 session. Possible values include: 'None', 'Idle', + * 'Connect', 'Active', 'OpenSent', 'OpenConfirm', 'OpenReceived', + * 'Established', 'PendingAdd', 'PendingUpdate', 'PendingRemove'. + */ + @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 IPv4 prefix that contains both ends' IPv4 addresses. + * + * @return the sessionPrefixV4 value + */ + public String sessionPrefixV4() { + return this.sessionPrefixV4; + } + + /** + * Set 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 IPv6 prefix that contains both ends' IPv6 addresses. + * + * @return the sessionPrefixV6 value + */ + public String sessionPrefixV6() { + return this.sessionPrefixV6; + } + + /** + * Set 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 IPv4 session address on Microsoft's end. + * + * @return the microsoftSessionIPv4Address value + */ + public String microsoftSessionIPv4Address() { + return this.microsoftSessionIPv4Address; + } + + /** + * Set 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 IPv6 session address on Microsoft's end. + * + * @return the microsoftSessionIPv6Address value + */ + public String microsoftSessionIPv6Address() { + return this.microsoftSessionIPv6Address; + } + + /** + * Set 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 IPv4 session address on peer's end. + * + * @return the peerSessionIPv4Address value + */ + public String peerSessionIPv4Address() { + return this.peerSessionIPv4Address; + } + + /** + * Set 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 IPv6 session address on peer's end. + * + * @return the peerSessionIPv6Address value + */ + public String peerSessionIPv6Address() { + return this.peerSessionIPv6Address; + } + + /** + * Set 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 state of the IPv4 session. Possible values include: 'None', 'Idle', 'Connect', 'Active', 'OpenSent', 'OpenConfirm', 'OpenReceived', 'Established', 'PendingAdd', 'PendingUpdate', 'PendingRemove'. + * + * @return the sessionStateV4 value + */ + public SessionStateV4 sessionStateV4() { + return this.sessionStateV4; + } + + /** + * Get the state of the IPv6 session. Possible values include: 'None', 'Idle', 'Connect', 'Active', 'OpenSent', 'OpenConfirm', 'OpenReceived', 'Established', 'PendingAdd', 'PendingUpdate', 'PendingRemove'. + * + * @return the sessionStateV6 value + */ + public SessionStateV6 sessionStateV6() { + return this.sessionStateV6; + } + + /** + * Get the maximum number of prefixes advertised over the IPv4 session. + * + * @return the maxPrefixesAdvertisedV4 value + */ + public Integer maxPrefixesAdvertisedV4() { + return this.maxPrefixesAdvertisedV4; + } + + /** + * Set 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 maximum number of prefixes advertised over the IPv6 session. + * + * @return the maxPrefixesAdvertisedV6 value + */ + public Integer maxPrefixesAdvertisedV6() { + return this.maxPrefixesAdvertisedV6; + } + + /** + * Set 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 MD5 authentication key of the session. + * + * @return the md5AuthenticationKey value + */ + public String md5AuthenticationKey() { + return this.md5AuthenticationKey; + } + + /** + * Set 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; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/CheckServiceProviderAvailabilityInput.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/CheckServiceProviderAvailabilityInput.java new file mode 100644 index 0000000000000..b639efcf8250f --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/CheckServiceProviderAvailabilityInput.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Class for CheckServiceProviderAvailabilityInput. + */ +public class CheckServiceProviderAvailabilityInput { + /** + * 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 gets or sets the peering service location. + * + * @return the peeringServiceLocation value + */ + public String peeringServiceLocation() { + return this.peeringServiceLocation; + } + + /** + * Set 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 gets or sets the peering service provider. + * + * @return the peeringServiceProvider value + */ + public String peeringServiceProvider() { + return this.peeringServiceProvider; + } + + /** + * Set 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; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ConnectionState.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ConnectionState.java new file mode 100644 index 0000000000000..fabd27680b90c --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ConnectionState.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * 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/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ContactDetail.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ContactDetail.java new file mode 100644 index 0000000000000..ed25ede5eac40 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ContactDetail.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The contact detail class. + */ +public class ContactDetail { + /** + * The role of the contact. Possible values include: 'Noc', 'Policy', + * 'Technical', 'Service', 'Escalation', 'Other'. + */ + @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 of the contact. Possible values include: 'Noc', 'Policy', 'Technical', 'Service', 'Escalation', 'Other'. + * + * @return the role value + */ + public Role role() { + return this.role; + } + + /** + * Set the role of the contact. Possible values include: 'Noc', 'Policy', 'Technical', 'Service', 'Escalation', 'Other'. + * + * @param role the role value to set + * @return the ContactDetail object itself. + */ + public ContactDetail withRole(Role role) { + this.role = role; + return this; + } + + /** + * Get the e-mail address of the contact. + * + * @return the email value + */ + public String email() { + return this.email; + } + + /** + * Set 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 number of the contact. + * + * @return the phone value + */ + public String phone() { + return this.phone; + } + + /** + * Set 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; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/DirectConnection.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/DirectConnection.java new file mode 100644 index 0000000000000..434c81220bef5 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/DirectConnection.java @@ -0,0 +1,223 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties that define a direct connection. + */ +public class DirectConnection { + /** + * 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. + * Possible values include: 'Microsoft', 'Peer'. + */ + @JsonProperty(value = "sessionAddressProvider") + private SessionAddressProvider sessionAddressProvider; + + /** + * The flag that indicates whether or not the connection is used for + * peering service. + */ + @JsonProperty(value = "useForPeeringService") + private Boolean useForPeeringService; + + /** + * The PeeringDB.com ID of the facility at which the connection has to be + * set up. + */ + @JsonProperty(value = "peeringDBFacilityId") + private Integer peeringDBFacilityId; + + /** + * The state of the connection. Possible values include: 'None', + * 'PendingApproval', 'Approved', 'ProvisioningStarted', + * 'ProvisioningFailed', 'ProvisioningCompleted', 'Validating', 'Active'. + */ + @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 bandwidth of the connection. + * + * @return the bandwidthInMbps value + */ + public Integer bandwidthInMbps() { + return this.bandwidthInMbps; + } + + /** + * Set 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 bandwidth that is actually provisioned. + * + * @return the provisionedBandwidthInMbps value + */ + public Integer provisionedBandwidthInMbps() { + return this.provisionedBandwidthInMbps; + } + + /** + * Get the field indicating if Microsoft provides session ip addresses. Possible values include: 'Microsoft', 'Peer'. + * + * @return the sessionAddressProvider value + */ + public SessionAddressProvider sessionAddressProvider() { + return this.sessionAddressProvider; + } + + /** + * Set the field indicating if Microsoft provides session ip addresses. Possible values include: 'Microsoft', 'Peer'. + * + * @param sessionAddressProvider the sessionAddressProvider value to set + * @return the DirectConnection object itself. + */ + public DirectConnection withSessionAddressProvider(SessionAddressProvider sessionAddressProvider) { + this.sessionAddressProvider = sessionAddressProvider; + return this; + } + + /** + * Get 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 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 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 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 state of the connection. Possible values include: 'None', 'PendingApproval', 'Approved', 'ProvisioningStarted', 'ProvisioningFailed', 'ProvisioningCompleted', 'Validating', 'Active'. + * + * @return the connectionState value + */ + public ConnectionState connectionState() { + return this.connectionState; + } + + /** + * Get the BGP session associated with the connection. + * + * @return the bgpSession value + */ + public BgpSession bgpSession() { + return this.bgpSession; + } + + /** + * Set 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 unique identifier (GUID) for the connection. + * + * @return the connectionIdentifier value + */ + public String connectionIdentifier() { + return this.connectionIdentifier; + } + + /** + * Set 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 error message related to the connection state, if any. + * + * @return the errorMessage value + */ + public String errorMessage() { + return this.errorMessage; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/DirectPeeringFacility.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/DirectPeeringFacility.java new file mode 100644 index 0000000000000..d635beacb859b --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/DirectPeeringFacility.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties that define a direct peering facility. + */ +public class DirectPeeringFacility { + /** + * The address of the direct peering facility. + */ + @JsonProperty(value = "address") + private String address; + + /** + * The type of the direct peering. Possible values include: 'Edge', + * 'Transit', 'Cdn', 'Internal', 'Ix', 'IxRs'. + */ + @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 of the direct peering facility. + * + * @return the address value + */ + public String address() { + return this.address; + } + + /** + * Set 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 type of the direct peering. Possible values include: 'Edge', 'Transit', 'Cdn', 'Internal', 'Ix', 'IxRs'. + * + * @return the directPeeringType value + */ + public DirectPeeringType directPeeringType() { + return this.directPeeringType; + } + + /** + * Set the type of the direct peering. Possible values include: 'Edge', 'Transit', 'Cdn', 'Internal', 'Ix', 'IxRs'. + * + * @param directPeeringType the directPeeringType value to set + * @return the DirectPeeringFacility object itself. + */ + public DirectPeeringFacility withDirectPeeringType(DirectPeeringType directPeeringType) { + this.directPeeringType = directPeeringType; + return this; + } + + /** + * Get the PeeringDB.com ID of the facility. + * + * @return the peeringDBFacilityId value + */ + public Integer peeringDBFacilityId() { + return this.peeringDBFacilityId; + } + + /** + * Set 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 PeeringDB.com URL of the facility. + * + * @return the peeringDBFacilityLink value + */ + public String peeringDBFacilityLink() { + return this.peeringDBFacilityLink; + } + + /** + * Set 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; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/DirectPeeringType.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/DirectPeeringType.java new file mode 100644 index 0000000000000..a0f28047baf35 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/DirectPeeringType.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * 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/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ErrorDetail.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ErrorDetail.java new file mode 100644 index 0000000000000..f733887f26c38 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ErrorDetail.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The error detail that describes why an operation has failed. + */ +public class ErrorDetail { + /** + * The error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * The error message. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get the error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get the error message. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ErrorResponse.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ErrorResponse.java new file mode 100644 index 0000000000000..c0c328c10500c --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ErrorResponse.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The error response that indicates why an operation has failed. + */ +public class ErrorResponse { + /** + * The error detail that describes why an operation has failed. + */ + @JsonProperty(value = "error") + private ErrorDetail error; + + /** + * Get the error detail that describes why an operation has failed. + * + * @return the error value + */ + public ErrorDetail error() { + return this.error; + } + + /** + * Set the error detail that describes why an operation has failed. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDetail error) { + this.error = error; + return this; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ErrorResponseException.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ErrorResponseException.java new file mode 100644 index 0000000000000..b991a9a5573a3 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ExchangeConnection.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ExchangeConnection.java new file mode 100644 index 0000000000000..dcc848d5ce73b --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ExchangeConnection.java @@ -0,0 +1,128 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties that define an exchange connection. + */ +public class ExchangeConnection { + /** + * 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. Possible values include: 'None', + * 'PendingApproval', 'Approved', 'ProvisioningStarted', + * 'ProvisioningFailed', 'ProvisioningCompleted', 'Validating', 'Active'. + */ + @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 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 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 state of the connection. Possible values include: 'None', 'PendingApproval', 'Approved', 'ProvisioningStarted', 'ProvisioningFailed', 'ProvisioningCompleted', 'Validating', 'Active'. + * + * @return the connectionState value + */ + public ConnectionState connectionState() { + return this.connectionState; + } + + /** + * Get the BGP session associated with the connection. + * + * @return the bgpSession value + */ + public BgpSession bgpSession() { + return this.bgpSession; + } + + /** + * Set 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 unique identifier (GUID) for the connection. + * + * @return the connectionIdentifier value + */ + public String connectionIdentifier() { + return this.connectionIdentifier; + } + + /** + * Set 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 error message related to the connection state, if any. + * + * @return the errorMessage value + */ + public String errorMessage() { + return this.errorMessage; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ExchangePeeringFacility.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ExchangePeeringFacility.java new file mode 100644 index 0000000000000..7b81ed2652ecb --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ExchangePeeringFacility.java @@ -0,0 +1,226 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties that define an exchange peering facility. + */ +public class ExchangePeeringFacility { + /** + * 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 name of the exchange peering facility. + * + * @return the exchangeName value + */ + public String exchangeName() { + return this.exchangeName; + } + + /** + * Set 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 bandwidth of the connection between Microsoft and the exchange peering facility. + * + * @return the bandwidthInMbps value + */ + public Integer bandwidthInMbps() { + return this.bandwidthInMbps; + } + + /** + * Set 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 IPv4 address of Microsoft at the exchange peering facility. + * + * @return the microsoftIPv4Address value + */ + public String microsoftIPv4Address() { + return this.microsoftIPv4Address; + } + + /** + * Set 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 IPv6 address of Microsoft at the exchange peering facility. + * + * @return the microsoftIPv6Address value + */ + public String microsoftIPv6Address() { + return this.microsoftIPv6Address; + } + + /** + * Set 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 IPv4 prefixes associated with the exchange peering facility. + * + * @return the facilityIPv4Prefix value + */ + public String facilityIPv4Prefix() { + return this.facilityIPv4Prefix; + } + + /** + * Set 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 IPv6 prefixes associated with the exchange peering facility. + * + * @return the facilityIPv6Prefix value + */ + public String facilityIPv6Prefix() { + return this.facilityIPv6Prefix; + } + + /** + * Set 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 PeeringDB.com ID of the facility. + * + * @return the peeringDBFacilityId value + */ + public Integer peeringDBFacilityId() { + return this.peeringDBFacilityId; + } + + /** + * Set 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 PeeringDB.com URL of the facility. + * + * @return the peeringDBFacilityLink value + */ + public String peeringDBFacilityLink() { + return this.peeringDBFacilityLink; + } + + /** + * Set 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; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Family.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Family.java new file mode 100644 index 0000000000000..34cba7eae59d5 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Family.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * 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/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Kind.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Kind.java new file mode 100644 index 0000000000000..df64edb8643f7 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Kind.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * 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/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/LearnedType.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/LearnedType.java new file mode 100644 index 0000000000000..28faf216e5fcf --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/LearnedType.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * 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/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/LegacyPeerings.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/LegacyPeerings.java new file mode 100644 index 0000000000000..07a32ff2047da --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/LegacyPeerings.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import rx.Observable; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.LegacyPeeringsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing LegacyPeerings. + */ +public interface LegacyPeerings extends HasInner { + /** + * 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. Possible values include: 'Direct', 'Exchange' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String peeringLocation, final String kind); + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Operation.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Operation.java new file mode 100644 index 0000000000000..d8d344e743456 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Operation.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringManager; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplayInfo display(); + + /** + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/OperationDisplayInfo.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/OperationDisplayInfo.java new file mode 100644 index 0000000000000..cd94202cb529b --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/OperationDisplayInfo.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The information related to the operation. + */ +public class OperationDisplayInfo { + /** + * 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 name of the resource provider. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get the type of the resource. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get the name of the operation. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Get the description of the operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Operations.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Operations.java new file mode 100644 index 0000000000000..98d86902c3c8d --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import rx.Observable; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available API operations for peering resources. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeerAsn.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeerAsn.java new file mode 100644 index 0000000000000..6c6978aa9bc1e --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeerAsn.java @@ -0,0 +1,197 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeerAsnInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringManager; +import java.util.List; + +/** + * Type representing PeerAsn. + */ +public interface PeerAsn extends HasInner, Indexable, Updatable, Refreshable, HasManager { + /** + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the peerAsn value. + */ + Integer peerAsn(); + + /** + * @return the peerContactDetail value. + */ + List peerContactDetail(); + + /** + * @return the peerName value. + */ + String peerName(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the validationState value. + */ + ValidationState validationState(); + + /** + * The entirety of the PeerAsn definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { + } + + /** + * Grouping of PeerAsn definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a PeerAsn definition. + */ + interface Blank extends WithCreate { + } + + /** + * The stage of the peerasn definition allowing to specify PeerAsn. + */ + interface WithPeerAsn { + /** + * Specifies peerAsn. + * @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 peerContactDetail. + * @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 peerName. + * @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 validationState. + * @param validationState The validation state of the ASN associated with the peer. Possible values include: 'None', 'Pending', 'Approved', 'Failed' + * @return the next definition stage + */ + WithCreate withValidationState(ValidationState validationState); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithPeerAsn, DefinitionStages.WithPeerContactDetail, DefinitionStages.WithPeerName, DefinitionStages.WithValidationState { + } + } + /** + * The template for a PeerAsn update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithPeerAsn, UpdateStages.WithPeerContactDetail, UpdateStages.WithPeerName, UpdateStages.WithValidationState { + } + + /** + * Grouping of PeerAsn update stages. + */ + interface UpdateStages { + /** + * The stage of the peerasn update allowing to specify PeerAsn. + */ + interface WithPeerAsn { + /** + * Specifies peerAsn. + * @param peerAsn The Autonomous System Number (ASN) of the peer + * @return the next update stage + */ + Update withPeerAsn(Integer peerAsn); + } + + /** + * The stage of the peerasn update allowing to specify PeerContactDetail. + */ + interface WithPeerContactDetail { + /** + * Specifies peerContactDetail. + * @param peerContactDetail The contact details of the peer + * @return the next update stage + */ + Update withPeerContactDetail(List peerContactDetail); + } + + /** + * The stage of the peerasn update allowing to specify PeerName. + */ + interface WithPeerName { + /** + * Specifies peerName. + * @param peerName The name of the peer + * @return the next update stage + */ + Update withPeerName(String peerName); + } + + /** + * The stage of the peerasn update allowing to specify ValidationState. + */ + interface WithValidationState { + /** + * Specifies validationState. + * @param validationState The validation state of the ASN associated with the peer. Possible values include: 'None', 'Pending', 'Approved', 'Failed' + * @return the next update stage + */ + Update withValidationState(ValidationState validationState); + } + + } +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeerAsns.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeerAsns.java new file mode 100644 index 0000000000000..31039dfd0c7e4 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeerAsns.java @@ -0,0 +1,40 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeerAsnsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PeerAsns. + */ +public interface PeerAsns extends SupportsCreating, SupportsListing, HasInner { + /** + * 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 + * @return the observable for the request + */ + Observable getAsync(String peerAsnName); + + /** + * 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 + * @return the observable for the request + */ + Completable deleteAsync(String peerAsnName); + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Peering.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Peering.java new file mode 100644 index 0000000000000..4ed453268a443 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Peering.java @@ -0,0 +1,194 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringManager; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringInner; + +/** + * Type representing Peering. + */ +public interface Peering extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the direct value. + */ + PeeringPropertiesDirect direct(); + + /** + * @return the exchange value. + */ + PeeringPropertiesExchange exchange(); + + /** + * @return the kind value. + */ + Kind kind(); + + /** + * @return the peeringLocation value. + */ + String peeringLocation(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * @return the sku value. + */ + PeeringSku sku(); + + /** + * The entirety of the Peering definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithKind, DefinitionStages.WithSku, DefinitionStages.WithCreate { + } + + /** + * Grouping of Peering definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Peering definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the Peering definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the peering definition allowing to specify Kind. + */ + interface WithKind { + /** + * Specifies kind. + * @param kind The kind of the peering. Possible values include: 'Direct', 'Exchange' + * @return the next definition stage +*/ + WithSku withKind(Kind kind); + } + + /** + * The stage of the peering definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The SKU that defines the tier and kind of the peering + * @return the next definition stage +*/ + WithCreate withSku(PeeringSku sku); + } + + /** + * The stage of the peering definition allowing to specify Direct. + */ + interface WithDirect { + /** + * Specifies direct. + * @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 exchange. + * @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 peeringLocation. + * @param peeringLocation The location of the peering + * @return the next definition stage + */ + WithCreate withPeeringLocation(String peeringLocation); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithDirect, DefinitionStages.WithExchange, DefinitionStages.WithPeeringLocation { + } + } + /** + * The template for a Peering update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithDirect, UpdateStages.WithExchange, UpdateStages.WithPeeringLocation { + } + + /** + * Grouping of Peering update stages. + */ + interface UpdateStages { + /** + * The stage of the peering update allowing to specify Direct. + */ + interface WithDirect { + /** + * Specifies direct. + * @param direct The properties that define a direct peering + * @return the next update stage + */ + Update withDirect(PeeringPropertiesDirect direct); + } + + /** + * The stage of the peering update allowing to specify Exchange. + */ + interface WithExchange { + /** + * Specifies exchange. + * @param exchange The properties that define an exchange peering + * @return the next update stage + */ + Update withExchange(PeeringPropertiesExchange exchange); + } + + /** + * The stage of the peering update allowing to specify PeeringLocation. + */ + interface WithPeeringLocation { + /** + * Specifies peeringLocation. + * @param peeringLocation The location of the peering + * @return the next update stage + */ + Update withPeeringLocation(String peeringLocation); + } + + } +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringBandwidthOffer.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringBandwidthOffer.java new file mode 100644 index 0000000000000..201ec28eeff3a --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringBandwidthOffer.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties that define a peering bandwidth offer. + */ +public class PeeringBandwidthOffer { + /** + * 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 name of the bandwidth offer. + * + * @return the offerName value + */ + public String offerName() { + return this.offerName; + } + + /** + * Set 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 value of the bandwidth offer in Mbps. + * + * @return the valueInMbps value + */ + public Integer valueInMbps() { + return this.valueInMbps; + } + + /** + * Set 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; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringLocation.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringLocation.java new file mode 100644 index 0000000000000..b6ce4ff85d825 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringLocation.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringManager; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringLocationInner; + +/** + * Type representing PeeringLocation. + */ +public interface PeeringLocation extends HasInner, HasManager { + /** + * @return the azureRegion value. + */ + String azureRegion(); + + /** + * @return the country value. + */ + String country(); + + /** + * @return the direct value. + */ + PeeringLocationPropertiesDirect direct(); + + /** + * @return the exchange value. + */ + PeeringLocationPropertiesExchange exchange(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + Kind kind(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the peeringLocation value. + */ + String peeringLocation(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringLocationPropertiesDirect.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringLocationPropertiesDirect.java new file mode 100644 index 0000000000000..bd5fdf9dc47f7 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringLocationPropertiesDirect.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties that define a direct peering location. + */ +public class PeeringLocationPropertiesDirect { + /** + * 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 list of direct peering facilities at the peering location. + * + * @return the peeringFacilities value + */ + public List peeringFacilities() { + return this.peeringFacilities; + } + + /** + * Set 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 list of bandwidth offers available at the peering location. + * + * @return the bandwidthOffers value + */ + public List bandwidthOffers() { + return this.bandwidthOffers; + } + + /** + * Set 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; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringLocationPropertiesExchange.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringLocationPropertiesExchange.java new file mode 100644 index 0000000000000..53b30a04db3aa --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringLocationPropertiesExchange.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties that define an exchange peering location. + */ +public class PeeringLocationPropertiesExchange { + /** + * The list of exchange peering facilities at the peering location. + */ + @JsonProperty(value = "peeringFacilities") + private List peeringFacilities; + + /** + * Get the list of exchange peering facilities at the peering location. + * + * @return the peeringFacilities value + */ + public List peeringFacilities() { + return this.peeringFacilities; + } + + /** + * Set 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; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringLocations.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringLocations.java new file mode 100644 index 0000000000000..38769fb9b8d19 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringLocations.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import rx.Observable; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringLocationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PeeringLocations. + */ +public interface PeeringLocations extends HasInner { + /** + * Lists all of the available peering locations for the specified kind of peering. + * + * @param kind The kind of the peering. Possible values include: 'Direct', 'Exchange' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String kind); + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringPropertiesDirect.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringPropertiesDirect.java new file mode 100644 index 0000000000000..390c4df6a979e --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringPropertiesDirect.java @@ -0,0 +1,114 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import java.util.List; +import com.microsoft.azure.SubResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties that define a direct peering. + */ +public class PeeringPropertiesDirect { + /** + * 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. Possible values include: 'Edge', 'Transit', + * 'Cdn', 'Internal', 'Ix', 'IxRs'. + */ + @JsonProperty(value = "directPeeringType") + private DirectPeeringType directPeeringType; + + /** + * Get the set of connections that constitute a direct peering. + * + * @return the connections value + */ + public List connections() { + return this.connections; + } + + /** + * Set 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 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 reference of the peer ASN. + * + * @return the peerAsn value + */ + public SubResource peerAsn() { + return this.peerAsn; + } + + /** + * Set 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 type of direct peering. Possible values include: 'Edge', 'Transit', 'Cdn', 'Internal', 'Ix', 'IxRs'. + * + * @return the directPeeringType value + */ + public DirectPeeringType directPeeringType() { + return this.directPeeringType; + } + + /** + * Set the type of direct peering. Possible values include: 'Edge', 'Transit', 'Cdn', 'Internal', 'Ix', 'IxRs'. + * + * @param directPeeringType the directPeeringType value to set + * @return the PeeringPropertiesDirect object itself. + */ + public PeeringPropertiesDirect withDirectPeeringType(DirectPeeringType directPeeringType) { + this.directPeeringType = directPeeringType; + return this; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringPropertiesExchange.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringPropertiesExchange.java new file mode 100644 index 0000000000000..a8edb1b28fee8 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringPropertiesExchange.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import java.util.List; +import com.microsoft.azure.SubResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties that define an exchange peering. + */ +public class PeeringPropertiesExchange { + /** + * 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 set of connections that constitute an exchange peering. + * + * @return the connections value + */ + public List connections() { + return this.connections; + } + + /** + * Set 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 reference of the peer ASN. + * + * @return the peerAsn value + */ + public SubResource peerAsn() { + return this.peerAsn; + } + + /** + * Set 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; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringReceivedRoute.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringReceivedRoute.java new file mode 100644 index 0000000000000..c17e53c788d00 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringReceivedRoute.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringReceivedRouteInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringManager; + +/** + * Type representing PeeringReceivedRoute. + */ +public interface PeeringReceivedRoute extends HasInner, HasManager { + /** + * @return the asPath value. + */ + String asPath(); + + /** + * @return the nextHop value. + */ + String nextHop(); + + /** + * @return the originAsValidationState value. + */ + String originAsValidationState(); + + /** + * @return the prefix value. + */ + String prefix(); + + /** + * @return the receivedTimestamp value. + */ + String receivedTimestamp(); + + /** + * @return the rpkiValidationState value. + */ + String rpkiValidationState(); + + /** + * @return the trustAnchor value. + */ + String trustAnchor(); + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringRegisteredAsn.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringRegisteredAsn.java new file mode 100644 index 0000000000000..081d3a5444b5b --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringRegisteredAsn.java @@ -0,0 +1,127 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringRegisteredAsnInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringManager; + +/** + * Type representing PeeringRegisteredAsn. + */ +public interface PeeringRegisteredAsn extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the asn value. + */ + Integer asn(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the peeringServicePrefixKey value. + */ + String peeringServicePrefixKey(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the PeeringRegisteredAsn definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithPeering, DefinitionStages.WithAsn, DefinitionStages.WithCreate { + } + + /** + * Grouping of PeeringRegisteredAsn definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a PeeringRegisteredAsn definition. + */ + interface Blank extends WithPeering { + } + + /** + * The stage of the peeringregisteredasn definition allowing to specify Peering. + */ + interface WithPeering { + /** + * Specifies resourceGroupName, peeringName. + * @param resourceGroupName The name of the resource group + * @param peeringName The name of the peering + * @return the next definition stage + */ + WithAsn withExistingPeering(String resourceGroupName, String peeringName); + } + + /** + * The stage of the peeringregisteredasn definition allowing to specify Asn. + */ + interface WithAsn { + /** + * Specifies asn. + * @param asn The customer's ASN from which traffic originates + * @return the next definition stage + */ + WithCreate withAsn(Integer asn); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a PeeringRegisteredAsn update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAsn { + } + + /** + * Grouping of PeeringRegisteredAsn update stages. + */ + interface UpdateStages { + /** + * The stage of the peeringregisteredasn update allowing to specify Asn. + */ + interface WithAsn { + /** + * Specifies asn. + * @param asn The customer's ASN from which traffic originates + * @return the next update stage + */ + Update withAsn(Integer asn); + } + + } +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringRegisteredPrefix.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringRegisteredPrefix.java new file mode 100644 index 0000000000000..23503dba55b95 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringRegisteredPrefix.java @@ -0,0 +1,137 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringRegisteredPrefixInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringManager; + +/** + * Type representing PeeringRegisteredPrefix. + */ +public interface PeeringRegisteredPrefix extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the peeringServicePrefixKey value. + */ + String peeringServicePrefixKey(); + + /** + * @return the prefix value. + */ + String prefix(); + + /** + * @return the prefixValidationState value. + */ + PrefixValidationState prefixValidationState(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the PeeringRegisteredPrefix definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithPeering, DefinitionStages.WithPrefix, DefinitionStages.WithCreate { + } + + /** + * Grouping of PeeringRegisteredPrefix definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a PeeringRegisteredPrefix definition. + */ + interface Blank extends WithPeering { + } + + /** + * The stage of the peeringregisteredprefix definition allowing to specify Peering. + */ + interface WithPeering { + /** + * Specifies resourceGroupName, peeringName. + * @param resourceGroupName The name of the resource group + * @param peeringName The name of the peering + * @return the next definition stage + */ + WithPrefix withExistingPeering(String resourceGroupName, String peeringName); + } + + /** + * The stage of the peeringregisteredprefix definition allowing to specify Prefix. + */ + interface WithPrefix { + /** + * Specifies prefix. + * @param prefix The customer's prefix from which traffic originates + * @return the next definition stage + */ + WithCreate withPrefix(String prefix); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a PeeringRegisteredPrefix update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithPrefix { + } + + /** + * Grouping of PeeringRegisteredPrefix update stages. + */ + interface UpdateStages { + /** + * The stage of the peeringregisteredprefix update allowing to specify Prefix. + */ + interface WithPrefix { + /** + * Specifies prefix. + * @param prefix The customer's prefix from which traffic originates + * @return the next update stage + */ + Update withPrefix(String prefix); + } + + } +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringService.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringService.java new file mode 100644 index 0000000000000..4c7903e3aa786 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringService.java @@ -0,0 +1,160 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringManager; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringServiceInner; + +/** + * Type representing PeeringService. + */ +public interface PeeringService extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the peeringServiceLocation value. + */ + String peeringServiceLocation(); + + /** + * @return the peeringServiceProvider value. + */ + String peeringServiceProvider(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * @return the sku value. + */ + PeeringServiceSku sku(); + + /** + * The entirety of the PeeringService definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of PeeringService definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a PeeringService definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the PeeringService definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the peeringservice definition allowing to specify PeeringServiceLocation. + */ + interface WithPeeringServiceLocation { + /** + * Specifies peeringServiceLocation. + * @param peeringServiceLocation The PeeringServiceLocation of the Customer + * @return the next definition stage + */ + WithCreate withPeeringServiceLocation(String peeringServiceLocation); + } + + /** + * The stage of the peeringservice definition allowing to specify PeeringServiceProvider. + */ + interface WithPeeringServiceProvider { + /** + * Specifies peeringServiceProvider. + * @param peeringServiceProvider The MAPS Provider Name + * @return the next definition stage + */ + WithCreate withPeeringServiceProvider(String peeringServiceProvider); + } + + /** + * The stage of the peeringservice definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @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 definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithPeeringServiceLocation, DefinitionStages.WithPeeringServiceProvider, DefinitionStages.WithSku { + } + } + /** + * The template for a PeeringService update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithPeeringServiceLocation, UpdateStages.WithPeeringServiceProvider, UpdateStages.WithSku { + } + + /** + * Grouping of PeeringService update stages. + */ + interface UpdateStages { + /** + * The stage of the peeringservice update allowing to specify PeeringServiceLocation. + */ + interface WithPeeringServiceLocation { + /** + * Specifies peeringServiceLocation. + * @param peeringServiceLocation The PeeringServiceLocation of the Customer + * @return the next update stage + */ + Update withPeeringServiceLocation(String peeringServiceLocation); + } + + /** + * The stage of the peeringservice update allowing to specify PeeringServiceProvider. + */ + interface WithPeeringServiceProvider { + /** + * Specifies peeringServiceProvider. + * @param peeringServiceProvider The MAPS Provider Name + * @return the next update stage + */ + Update withPeeringServiceProvider(String peeringServiceProvider); + } + + /** + * The stage of the peeringservice update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The SKU that defines the type of the peering service + * @return the next update stage + */ + Update withSku(PeeringServiceSku sku); + } + + } +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServiceCountries.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServiceCountries.java new file mode 100644 index 0000000000000..0eeae2fe59a05 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServiceCountries.java @@ -0,0 +1,19 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringServiceCountriesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PeeringServiceCountries. + */ +public interface PeeringServiceCountries extends SupportsListing, HasInner { +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServiceCountry.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServiceCountry.java new file mode 100644 index 0000000000000..7b9509c979913 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServiceCountry.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringServiceCountryInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringManager; + +/** + * Type representing PeeringServiceCountry. + */ +public interface PeeringServiceCountry extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServiceLocation.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServiceLocation.java new file mode 100644 index 0000000000000..7a572e07c18c0 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServiceLocation.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringServiceLocationInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringManager; + +/** + * Type representing PeeringServiceLocation. + */ +public interface PeeringServiceLocation extends HasInner, HasManager { + /** + * @return the azureRegion value. + */ + String azureRegion(); + + /** + * @return the country value. + */ + String country(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the state value. + */ + String state(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServiceLocations.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServiceLocations.java new file mode 100644 index 0000000000000..e1341fdbede11 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServiceLocations.java @@ -0,0 +1,19 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringServiceLocationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PeeringServiceLocations. + */ +public interface PeeringServiceLocations extends SupportsListing, HasInner { +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServicePrefix.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServicePrefix.java new file mode 100644 index 0000000000000..1f87e12cf3897 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServicePrefix.java @@ -0,0 +1,172 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringServicePrefixInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringManager; +import java.util.List; + +/** + * Type representing PeeringServicePrefix. + */ +public interface PeeringServicePrefix extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * @return the events value. + */ + List events(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the learnedType value. + */ + LearnedType learnedType(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the peeringServicePrefixKey value. + */ + String peeringServicePrefixKey(); + + /** + * @return the prefix value. + */ + String prefix(); + + /** + * @return the prefixValidationState value. + */ + PrefixValidationState prefixValidationState(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the PeeringServicePrefix definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithPeeringService, DefinitionStages.WithCreate { + } + + /** + * Grouping of PeeringServicePrefix definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a PeeringServicePrefix definition. + */ + interface Blank extends WithPeeringService { + } + + /** + * The stage of the peeringserviceprefix definition allowing to specify PeeringService. + */ + interface WithPeeringService { + /** + * 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 allowing to specify PeeringServicePrefixKey. + */ + interface WithPeeringServicePrefixKey { + /** + * Specifies peeringServicePrefixKey. + * @param peeringServicePrefixKey The peering service prefix key + * @return the next definition stage + */ + WithCreate withPeeringServicePrefixKey(String peeringServicePrefixKey); + } + + /** + * The stage of the peeringserviceprefix definition allowing to specify Prefix. + */ + interface WithPrefix { + /** + * Specifies prefix. + * @param prefix The prefix from which your traffic originates + * @return the next definition stage + */ + WithCreate withPrefix(String prefix); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithPeeringServicePrefixKey, DefinitionStages.WithPrefix { + } + } + /** + * The template for a PeeringServicePrefix update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithPeeringServicePrefixKey, UpdateStages.WithPrefix { + } + + /** + * Grouping of PeeringServicePrefix update stages. + */ + interface UpdateStages { + /** + * The stage of the peeringserviceprefix update allowing to specify PeeringServicePrefixKey. + */ + interface WithPeeringServicePrefixKey { + /** + * Specifies peeringServicePrefixKey. + * @param peeringServicePrefixKey The peering service prefix key + * @return the next update stage + */ + Update withPeeringServicePrefixKey(String peeringServicePrefixKey); + } + + /** + * The stage of the peeringserviceprefix update allowing to specify Prefix. + */ + interface WithPrefix { + /** + * Specifies prefix. + * @param prefix The prefix from which your traffic originates + * @return the next update stage + */ + Update withPrefix(String prefix); + } + + } +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServicePrefixEvent.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServicePrefixEvent.java new file mode 100644 index 0000000000000..0673d4881babb --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServicePrefixEvent.java @@ -0,0 +1,93 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the event associated with a prefix. + */ +public class PeeringServicePrefixEvent { + /** + * The timestamp of the event associated with a prefix. + */ + @JsonProperty(value = "eventTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private DateTime 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 timestamp of the event associated with a prefix. + * + * @return the eventTimestamp value + */ + public DateTime eventTimestamp() { + return this.eventTimestamp; + } + + /** + * Get the type of the event associated with a prefix. + * + * @return the eventType value + */ + public String eventType() { + return this.eventType; + } + + /** + * Get the summary of the event associated with a prefix. + * + * @return the eventSummary value + */ + public String eventSummary() { + return this.eventSummary; + } + + /** + * Get the level of the event associated with a prefix. + * + * @return the eventLevel value + */ + public String eventLevel() { + return this.eventLevel; + } + + /** + * Get the description of the event associated with a prefix. + * + * @return the eventDescription value + */ + public String eventDescription() { + return this.eventDescription; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServiceProvider.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServiceProvider.java new file mode 100644 index 0000000000000..6e9a9dd9cd0fb --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServiceProvider.java @@ -0,0 +1,40 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringServiceProviderInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringManager; + +/** + * Type representing PeeringServiceProvider. + */ +public interface PeeringServiceProvider extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the serviceProviderName value. + */ + String serviceProviderName(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServiceProviders.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServiceProviders.java new file mode 100644 index 0000000000000..caf4aee395eb7 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServiceProviders.java @@ -0,0 +1,19 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringServiceProvidersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PeeringServiceProviders. + */ +public interface PeeringServiceProviders extends SupportsListing, HasInner { +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServiceSku.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServiceSku.java new file mode 100644 index 0000000000000..b5bc270764a11 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServiceSku.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The SKU that defines the type of the peering service. + */ +public class PeeringServiceSku { + /** + * The name of the peering service SKU. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get the name of the peering service SKU. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set 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; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServices.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServices.java new file mode 100644 index 0000000000000..bf8b03b59e1b7 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringServices.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringServicesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PeeringServices. + */ +public interface PeeringServices extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringSku.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringSku.java new file mode 100644 index 0000000000000..c1857df8ec302 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PeeringSku.java @@ -0,0 +1,124 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The SKU that defines the tier and kind of the peering. + */ +public class PeeringSku { + /** + * The name of the peering SKU. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The tier of the peering SKU. Possible values include: 'Basic', + * 'Premium'. + */ + @JsonProperty(value = "tier") + private Tier tier; + + /** + * The family of the peering SKU. Possible values include: 'Direct', + * 'Exchange'. + */ + @JsonProperty(value = "family") + private Family family; + + /** + * The size of the peering SKU. Possible values include: 'Free', 'Metered', + * 'Unlimited'. + */ + @JsonProperty(value = "size") + private Size size; + + /** + * Get the name of the peering SKU. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set 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 of the peering SKU. Possible values include: 'Basic', 'Premium'. + * + * @return the tier value + */ + public Tier tier() { + return this.tier; + } + + /** + * Set the tier of the peering SKU. Possible values include: 'Basic', 'Premium'. + * + * @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 of the peering SKU. Possible values include: 'Direct', 'Exchange'. + * + * @return the family value + */ + public Family family() { + return this.family; + } + + /** + * Set the family of the peering SKU. Possible values include: 'Direct', 'Exchange'. + * + * @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 of the peering SKU. Possible values include: 'Free', 'Metered', 'Unlimited'. + * + * @return the size value + */ + public Size size() { + return this.size; + } + + /** + * Set the size of the peering SKU. Possible values include: 'Free', 'Metered', 'Unlimited'. + * + * @param size the size value to set + * @return the PeeringSku object itself. + */ + public PeeringSku withSize(Size size) { + this.size = size; + return this; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Peerings.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Peerings.java new file mode 100644 index 0000000000000..1e9d079e84202 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Peerings.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PeeringsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Peerings. + */ +public interface Peerings extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PrefixValidationState.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PrefixValidationState.java new file mode 100644 index 0000000000000..6886705b4afdd --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/PrefixValidationState.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * 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/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Prefixes.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Prefixes.java new file mode 100644 index 0000000000000..596cbb830c1f4 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Prefixes.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.PrefixesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Prefixes. + */ +public interface Prefixes extends SupportsCreating, HasInner { + /** + * 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 + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String peeringServiceName, String prefixName); + + /** + * 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 + * @return the observable for the request + */ + Observable listByPeeringServiceAsync(final String resourceGroupName, final String peeringServiceName); + + /** + * 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 + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String peeringServiceName, String prefixName); + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ProvisioningState.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ProvisioningState.java new file mode 100644 index 0000000000000..028148577f850 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ProvisioningState.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * 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/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ReceivedRoutes.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ReceivedRoutes.java new file mode 100644 index 0000000000000..4eafb191f49e0 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ReceivedRoutes.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import rx.Observable; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.ReceivedRoutesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReceivedRoutes. + */ +public interface ReceivedRoutes extends HasInner { + /** + * 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 + * @return the observable for the request + */ + Observable listByPeeringAsync(final String resourceGroupName, final String peeringName); + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/RegisteredAsns.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/RegisteredAsns.java new file mode 100644 index 0000000000000..d4cad512d5af2 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/RegisteredAsns.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.RegisteredAsnsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing RegisteredAsns. + */ +public interface RegisteredAsns extends SupportsCreating, HasInner { + /** + * 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 + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String peeringName, String registeredAsnName); + + /** + * 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 + * @return the observable for the request + */ + Observable listByPeeringAsync(final String resourceGroupName, final String peeringName); + + /** + * 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 + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String peeringName, String registeredAsnName); + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/RegisteredPrefixes.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/RegisteredPrefixes.java new file mode 100644 index 0000000000000..ebd31cef289d2 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/RegisteredPrefixes.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.peering.v2020_04_01.implementation.RegisteredPrefixesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing RegisteredPrefixes. + */ +public interface RegisteredPrefixes extends SupportsCreating, HasInner { + /** + * 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 + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String peeringName, String registeredPrefixName); + + /** + * 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 + * @return the observable for the request + */ + Observable listByPeeringAsync(final String resourceGroupName, final String peeringName); + + /** + * 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 + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String peeringName, String registeredPrefixName); + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ResourceTags.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ResourceTags.java new file mode 100644 index 0000000000000..0a333d66fa878 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ResourceTags.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The resource tags. + */ +public class ResourceTags { + /** + * Gets or sets the tags, a dictionary of descriptors arm object. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get gets or sets the tags, a dictionary of descriptors arm object. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set 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; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Role.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Role.java new file mode 100644 index 0000000000000..8d6d6adf50d0a --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Role.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * 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/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/SessionAddressProvider.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/SessionAddressProvider.java new file mode 100644 index 0000000000000..545638cba5a44 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/SessionAddressProvider.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * 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/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/SessionStateV4.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/SessionStateV4.java new file mode 100644 index 0000000000000..2dbfcf88882de --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/SessionStateV4.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * 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/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/SessionStateV6.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/SessionStateV6.java new file mode 100644 index 0000000000000..424cd9044db0b --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/SessionStateV6.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * 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/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Size.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Size.java new file mode 100644 index 0000000000000..8eaacade52bd5 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Size.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * 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/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Tier.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Tier.java new file mode 100644 index 0000000000000..0f2f1641716b2 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/Tier.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * 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/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ValidationState.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ValidationState.java new file mode 100644 index 0000000000000..543bf63f9e4ca --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/ValidationState.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * 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/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/IdParsingUtils.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..e0afd39669104 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/LegacyPeeringsImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/LegacyPeeringsImpl.java new file mode 100644 index 0000000000000..845b5c92c2856 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/LegacyPeeringsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.peering.v2020_04_01.LegacyPeerings; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.peering.v2020_04_01.Peering; + +class LegacyPeeringsImpl extends WrapperImpl implements LegacyPeerings { + private final PeeringManager manager; + + LegacyPeeringsImpl(PeeringManager manager) { + super(manager.inner().legacyPeerings()); + this.manager = manager; + } + + public PeeringManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(final String peeringLocation, final String kind) { + LegacyPeeringsInner client = this.inner(); + return client.listAsync(peeringLocation, kind) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Peering call(PeeringInner inner) { + return new PeeringImpl(inner.name(), inner, manager()); + } + }); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/LegacyPeeringsInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/LegacyPeeringsInner.java new file mode 100644 index 0000000000000..5b3d8b60a894d --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/LegacyPeeringsInner.java @@ -0,0 +1,425 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.peering.v2020_04_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in LegacyPeerings. + */ +public class LegacyPeeringsInner { + /** The Retrofit service to perform REST calls. */ + private LegacyPeeringsService service; + /** The service client containing this operation class. */ + private PeeringManagementClientImpl client; + + /** + * Initializes an instance of LegacyPeeringsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LegacyPeeringsInner(Retrofit retrofit, PeeringManagementClientImpl client) { + this.service = retrofit.create(LegacyPeeringsService.class); + this.client = client; + } + + /** + * The interface defining all the services for LegacyPeerings to be + * used by Retrofit to perform actually REST calls. + */ + interface LegacyPeeringsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.LegacyPeerings list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Peering/legacyPeerings") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("peeringLocation") String peeringLocation, @Query("kind") String kind, @Query("asn") Integer asn, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.LegacyPeerings listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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. Possible values include: 'Direct', 'Exchange' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringInner> object if successful. + */ + public PagedList list(final String peeringLocation, final String kind) { + ServiceResponse> response = listSinglePageAsync(peeringLocation, kind).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * 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. Possible values include: 'Direct', 'Exchange' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String peeringLocation, final String kind, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(peeringLocation, kind), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * 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. Possible values include: 'Direct', 'Exchange' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringInner> object + */ + public Observable> listAsync(final String peeringLocation, final String kind) { + return listWithServiceResponseAsync(peeringLocation, kind) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * 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. Possible values include: 'Direct', 'Exchange' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringInner> object + */ + public Observable>> listWithServiceResponseAsync(final String peeringLocation, final String kind) { + return listSinglePageAsync(peeringLocation, kind) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * 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. Possible values include: 'Direct', 'Exchange' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String peeringLocation, final String kind) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (peeringLocation == null) { + throw new IllegalArgumentException("Parameter peeringLocation is required and cannot be null."); + } + if (kind == null) { + throw new IllegalArgumentException("Parameter kind is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Integer asn = null; + return service.list(this.client.subscriptionId(), peeringLocation, kind, asn, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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. Possible values include: 'Direct', 'Exchange' + * @param asn The ASN number associated with a legacy peering. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringInner> object if successful. + */ + public PagedList list(final String peeringLocation, final String kind, final Integer asn) { + ServiceResponse> response = listSinglePageAsync(peeringLocation, kind, asn).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * 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. Possible values include: 'Direct', 'Exchange' + * @param asn The ASN number associated with a legacy peering. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String peeringLocation, final String kind, final Integer asn, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(peeringLocation, kind, asn), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * 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. Possible values include: 'Direct', 'Exchange' + * @param asn The ASN number associated with a legacy peering. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringInner> object + */ + public Observable> listAsync(final String peeringLocation, final String kind, final Integer asn) { + return listWithServiceResponseAsync(peeringLocation, kind, asn) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * 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. Possible values include: 'Direct', 'Exchange' + * @param asn The ASN number associated with a legacy peering. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringInner> object + */ + public Observable>> listWithServiceResponseAsync(final String peeringLocation, final String kind, final Integer asn) { + return listSinglePageAsync(peeringLocation, kind, asn) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the legacy peerings under the given subscription matching the specified kind and location. + * + ServiceResponse> * @param peeringLocation The location of the peering. + ServiceResponse> * @param kind The kind of the peering. Possible values include: 'Direct', 'Exchange' + ServiceResponse> * @param asn The ASN number associated with a legacy peering. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String peeringLocation, final String kind, final Integer asn) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (peeringLocation == null) { + throw new IllegalArgumentException("Parameter peeringLocation is required and cannot be null."); + } + if (kind == null) { + throw new IllegalArgumentException("Parameter kind is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), peeringLocation, kind, asn, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the legacy peerings under the given subscription matching the specified kind and location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the legacy peerings under the given subscription matching the specified kind and location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the legacy peerings under the given subscription matching the specified kind and location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the legacy peerings under the given subscription matching the specified kind and location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the legacy peerings under the given subscription matching the specified kind and location. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/OperationImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/OperationImpl.java new file mode 100644 index 0000000000000..afcbc86519e06 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/OperationImpl.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.management.peering.v2020_04_01.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.peering.v2020_04_01.OperationDisplayInfo; + +class OperationImpl extends WrapperImpl implements Operation { + private final PeeringManager manager; + OperationImpl(OperationInner inner, PeeringManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public PeeringManager manager() { + return this.manager; + } + + @Override + public OperationDisplayInfo display() { + return this.inner().display(); + } + + @Override + public Boolean isDataAction() { + return this.inner().isDataAction(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/OperationInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/OperationInner.java new file mode 100644 index 0000000000000..4f2a31434c00e --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/OperationInner.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.management.peering.v2020_04_01.OperationDisplayInfo; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The peering API operation. + */ +public class OperationInner { + /** + * 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 of the operation. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the information related to the operation. + * + * @return the display value + */ + public OperationDisplayInfo display() { + return this.display; + } + + /** + * Get the flag that indicates whether the operation applies to data plane. + * + * @return the isDataAction value + */ + public Boolean isDataAction() { + return this.isDataAction; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/OperationsImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..49849ab7bcd0d --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.peering.v2020_04_01.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.peering.v2020_04_01.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final PeeringManager manager; + + OperationsImpl(PeeringManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public PeeringManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/OperationsInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/OperationsInner.java new file mode 100644 index 0000000000000..ec767580abeb0 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.peering.v2020_04_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private PeeringManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, PeeringManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.Operations list" }) + @GET("providers/Microsoft.Peering/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available API operations for peering resources. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available API operations for peering resources. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available API operations for peering resources. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available API operations for peering resources. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available API operations for peering resources. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the available API operations for peering resources. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available API operations for peering resources. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available API operations for peering resources. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available API operations for peering resources. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available API operations for peering resources. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PageImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PageImpl.java new file mode 100644 index 0000000000000..6583fb66cd36f --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeerAsnImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeerAsnImpl.java new file mode 100644 index 0000000000000..2adb25e6290be --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeerAsnImpl.java @@ -0,0 +1,136 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.management.peering.v2020_04_01.PeerAsn; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.peering.v2020_04_01.ContactDetail; +import com.microsoft.azure.management.peering.v2020_04_01.ValidationState; + +class PeerAsnImpl extends CreatableUpdatableImpl implements PeerAsn, PeerAsn.Definition, PeerAsn.Update { + private String peerAsnName; + private final PeeringManager manager; + + PeerAsnImpl(String name, PeeringManager manager) { + super(name, new PeerAsnInner()); + this.manager = manager; + // Set resource name + this.peerAsnName = name; + // + } + + PeerAsnImpl(PeerAsnInner inner, PeeringManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.peerAsnName = inner.name(); + // set resource ancestor and positional variables + this.peerAsnName = IdParsingUtils.getValueFromIdByName(inner.id(), "peerAsns"); + // set other parameters for create and update + } + + @Override + public PeeringManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + PeerAsnsInner client = this.manager().inner().peerAsns(); + return client.createOrUpdateAsync(this.peerAsnName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + PeerAsnsInner client = this.manager().inner().peerAsns(); + return client.createOrUpdateAsync(this.peerAsnName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + PeerAsnsInner client = this.manager().inner().peerAsns(); + return client.getAsync(this.peerAsnName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String errorMessage() { + return this.inner().errorMessage(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Integer peerAsn() { + return this.inner().peerAsn(); + } + + @Override + public List peerContactDetail() { + return this.inner().peerContactDetail(); + } + + @Override + public String peerName() { + return this.inner().peerName(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ValidationState validationState() { + return this.inner().validationState(); + } + + @Override + public PeerAsnImpl withPeerAsn(Integer peerAsn) { + this.inner().withPeerAsn(peerAsn); + return this; + } + + @Override + public PeerAsnImpl withPeerContactDetail(List peerContactDetail) { + this.inner().withPeerContactDetail(peerContactDetail); + return this; + } + + @Override + public PeerAsnImpl withPeerName(String peerName) { + this.inner().withPeerName(peerName); + return this; + } + + @Override + public PeerAsnImpl withValidationState(ValidationState validationState) { + this.inner().withValidationState(validationState); + return this; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeerAsnInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeerAsnInner.java new file mode 100644 index 0000000000000..8abab8abd93b4 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeerAsnInner.java @@ -0,0 +1,143 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.peering.v2020_04_01.ContactDetail; +import com.microsoft.azure.management.peering.v2020_04_01.ValidationState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The essential information related to the peer's ASN. + */ +@JsonFlatten +public class PeerAsnInner extends ProxyResource { + /** + * 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. Possible + * values include: 'None', 'Pending', 'Approved', 'Failed'. + */ + @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 Autonomous System Number (ASN) of the peer. + * + * @return the peerAsn value + */ + public Integer peerAsn() { + return this.peerAsn; + } + + /** + * Set 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 contact details of the peer. + * + * @return the peerContactDetail value + */ + public List peerContactDetail() { + return this.peerContactDetail; + } + + /** + * Set 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 name of the peer. + * + * @return the peerName value + */ + public String peerName() { + return this.peerName; + } + + /** + * Set 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 validation state of the ASN associated with the peer. Possible values include: 'None', 'Pending', 'Approved', 'Failed'. + * + * @return the validationState value + */ + public ValidationState validationState() { + return this.validationState; + } + + /** + * Set the validation state of the ASN associated with the peer. Possible values include: 'None', 'Pending', 'Approved', 'Failed'. + * + * @param validationState the validationState value to set + * @return the PeerAsnInner object itself. + */ + public PeerAsnInner withValidationState(ValidationState validationState) { + this.validationState = validationState; + return this; + } + + /** + * Get the error message for the validation state. + * + * @return the errorMessage value + */ + public String errorMessage() { + return this.errorMessage; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeerAsnsImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeerAsnsImpl.java new file mode 100644 index 0000000000000..0b10b3c6a8430 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeerAsnsImpl.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * jkl + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.peering.v2020_04_01.PeerAsns; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import rx.Completable; +import com.microsoft.azure.management.peering.v2020_04_01.PeerAsn; +import com.microsoft.azure.arm.utils.PagedListConverter; + +class PeerAsnsImpl extends WrapperImpl implements PeerAsns { + private PagedListConverter converter; + private final PeeringManager manager; + + PeerAsnsImpl(PeeringManager manager) { + super(manager.inner().peerAsns()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(PeerAsnInner inner) { + return Observable.just((PeerAsn) wrapModel(inner)); + } + }; + } + + public PeeringManager manager() { + return this.manager; + } + + @Override + public PeerAsnImpl define(String name) { + return wrapModel(name); + } + + private PeerAsnImpl wrapModel(PeerAsnInner inner) { + return new PeerAsnImpl(inner, manager()); + } + + private PeerAsnImpl wrapModel(String name) { + return new PeerAsnImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String peerAsnName) { + PeerAsnsInner client = this.inner(); + return client.getAsync(peerAsnName) + .map(new Func1() { + @Override + public PeerAsn call(PeerAsnInner inner) { + return new PeerAsnImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String peerAsnName) { + PeerAsnsInner client = this.inner(); + return client.deleteAsync(peerAsnName).toCompletable(); + } + + @Override + public PagedList list() { + PeerAsnsInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + PeerAsnsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PeerAsn call(PeerAsnInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeerAsnsInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeerAsnsInner.java new file mode 100644 index 0000000000000..671050560a398 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeerAsnsInner.java @@ -0,0 +1,550 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.peering.v2020_04_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PeerAsns. + */ +public class PeerAsnsInner { + /** The Retrofit service to perform REST calls. */ + private PeerAsnsService service; + /** The service client containing this operation class. */ + private PeeringManagementClientImpl client; + + /** + * Initializes an instance of PeerAsnsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PeerAsnsInner(Retrofit retrofit, PeeringManagementClientImpl client) { + this.service = retrofit.create(PeerAsnsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PeerAsns to be + * used by Retrofit to perform actually REST calls. + */ + interface PeerAsnsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.PeerAsns get" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/{peerAsnName}") + Observable> get(@Path("peerAsnName") String peerAsnName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.PeerAsns createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/{peerAsnName}") + Observable> createOrUpdate(@Path("peerAsnName") String peerAsnName, @Path("subscriptionId") String subscriptionId, @Body PeerAsnInner peerAsn, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.PeerAsns delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/{peerAsnName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("peerAsnName") String peerAsnName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.PeerAsns list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.PeerAsns listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PeerAsnInner object if successful. + */ + public PeerAsnInner get(String peerAsnName) { + return getWithServiceResponseAsync(peerAsnName).toBlocking().single().body(); + } + + /** + * Gets the peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String peerAsnName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(peerAsnName), serviceCallback); + } + + /** + * 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 + * @return the observable to the PeerAsnInner object + */ + public Observable getAsync(String peerAsnName) { + return getWithServiceResponseAsync(peerAsnName).map(new Func1, PeerAsnInner>() { + @Override + public PeerAsnInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the PeerAsnInner object + */ + public Observable> getWithServiceResponseAsync(String peerAsnName) { + if (peerAsnName == null) { + throw new IllegalArgumentException("Parameter peerAsnName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(peerAsnName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PeerAsnInner object if successful. + */ + public PeerAsnInner createOrUpdate(String peerAsnName, PeerAsnInner peerAsn) { + return createOrUpdateWithServiceResponseAsync(peerAsnName, peerAsn).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String peerAsnName, PeerAsnInner peerAsn, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(peerAsnName, peerAsn), serviceCallback); + } + + /** + * 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 + * @return the observable to the PeerAsnInner object + */ + public Observable createOrUpdateAsync(String peerAsnName, PeerAsnInner peerAsn) { + return createOrUpdateWithServiceResponseAsync(peerAsnName, peerAsn).map(new Func1, PeerAsnInner>() { + @Override + public PeerAsnInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the PeerAsnInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String peerAsnName, PeerAsnInner peerAsn) { + if (peerAsnName == null) { + throw new IllegalArgumentException("Parameter peerAsnName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (peerAsn == null) { + throw new IllegalArgumentException("Parameter peerAsn is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(peerAsn); + return service.createOrUpdate(peerAsnName, this.client.subscriptionId(), peerAsn, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String peerAsnName) { + deleteWithServiceResponseAsync(peerAsnName).toBlocking().single().body(); + } + + /** + * Deletes an existing peer ASN with the specified name under the given subscription. + * + * @param peerAsnName The peer ASN name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String peerAsnName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(peerAsnName), serviceCallback); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String peerAsnName) { + return deleteWithServiceResponseAsync(peerAsnName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String peerAsnName) { + if (peerAsnName == null) { + throw new IllegalArgumentException("Parameter peerAsnName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(peerAsnName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the peer ASNs under the given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeerAsnInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the peer ASNs under the given subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the peer ASNs under the given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeerAsnInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the peer ASNs under the given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeerAsnInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the peer ASNs under the given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeerAsnInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the peer ASNs under the given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeerAsnInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the peer ASNs under the given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the peer ASNs under the given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeerAsnInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the peer ASNs under the given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeerAsnInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the peer ASNs under the given subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeerAsnInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringImpl.java new file mode 100644 index 0000000000000..0dac050a80ba7 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringImpl.java @@ -0,0 +1,111 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.peering.v2020_04_01.Peering; +import rx.Observable; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringSku; +import com.microsoft.azure.management.peering.v2020_04_01.Kind; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringPropertiesDirect; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringPropertiesExchange; +import com.microsoft.azure.management.peering.v2020_04_01.ProvisioningState; + +class PeeringImpl extends GroupableResourceCoreImpl implements Peering, Peering.Definition, Peering.Update { + PeeringImpl(String name, PeeringInner inner, PeeringManager manager) { + super(name, inner, manager); + } + + @Override + public Observable createResourceAsync() { + PeeringsInner client = this.manager().inner().peerings(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + PeeringsInner client = this.manager().inner().peerings(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + PeeringsInner client = this.manager().inner().peerings(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public PeeringPropertiesDirect direct() { + return this.inner().direct(); + } + + @Override + public PeeringPropertiesExchange exchange() { + return this.inner().exchange(); + } + + @Override + public Kind kind() { + return this.inner().kind(); + } + + @Override + public String peeringLocation() { + return this.inner().peeringLocation(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public PeeringSku sku() { + return this.inner().sku(); + } + + @Override + public PeeringImpl withKind(Kind kind) { + this.inner().withKind(kind); + return this; + } + + @Override + public PeeringImpl withSku(PeeringSku sku) { + this.inner().withSku(sku); + return this; + } + + @Override + public PeeringImpl withDirect(PeeringPropertiesDirect direct) { + this.inner().withDirect(direct); + return this; + } + + @Override + public PeeringImpl withExchange(PeeringPropertiesExchange exchange) { + this.inner().withExchange(exchange); + return this; + } + + @Override + public PeeringImpl withPeeringLocation(String peeringLocation) { + this.inner().withPeeringLocation(peeringLocation); + return this; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringInner.java new file mode 100644 index 0000000000000..8f3d67349d22e --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringInner.java @@ -0,0 +1,225 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.management.peering.v2020_04_01.PeeringSku; +import com.microsoft.azure.management.peering.v2020_04_01.Kind; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringPropertiesDirect; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringPropertiesExchange; +import com.microsoft.azure.management.peering.v2020_04_01.ProvisioningState; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Peering is a logical representation of a set of connections to the Microsoft + * Cloud Edge at a location. + */ +@JsonFlatten +public class PeeringInner extends ProxyResource { + /** + * The SKU that defines the tier and kind of the peering. + */ + @JsonProperty(value = "sku", required = true) + private PeeringSku sku; + + /** + * The kind of the peering. Possible values include: 'Direct', 'Exchange'. + */ + @JsonProperty(value = "kind", required = true) + private Kind kind; + + /** + * 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. Possible values include: + * 'Succeeded', 'Updating', 'Deleting', 'Failed'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * The location of the resource. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * The resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the SKU that defines the tier and kind of the peering. + * + * @return the sku value + */ + public PeeringSku sku() { + return this.sku; + } + + /** + * Set 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 of the peering. Possible values include: 'Direct', 'Exchange'. + * + * @return the kind value + */ + public Kind kind() { + return this.kind; + } + + /** + * Set the kind of the peering. Possible values include: 'Direct', 'Exchange'. + * + * @param kind the kind value to set + * @return the PeeringInner object itself. + */ + public PeeringInner withKind(Kind kind) { + this.kind = kind; + return this; + } + + /** + * Get the properties that define a direct peering. + * + * @return the direct value + */ + public PeeringPropertiesDirect direct() { + return this.direct; + } + + /** + * Set 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 properties that define an exchange peering. + * + * @return the exchange value + */ + public PeeringPropertiesExchange exchange() { + return this.exchange; + } + + /** + * Set 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 location of the peering. + * + * @return the peeringLocation value + */ + public String peeringLocation() { + return this.peeringLocation; + } + + /** + * Set 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 provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the location of the resource. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set 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 resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set 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; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringLocationImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringLocationImpl.java new file mode 100644 index 0000000000000..3c58695323673 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringLocationImpl.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.management.peering.v2020_04_01.PeeringLocation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringLocationPropertiesDirect; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringLocationPropertiesExchange; +import com.microsoft.azure.management.peering.v2020_04_01.Kind; + +class PeeringLocationImpl extends WrapperImpl implements PeeringLocation { + private final PeeringManager manager; + PeeringLocationImpl(PeeringLocationInner inner, PeeringManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public PeeringManager manager() { + return this.manager; + } + + @Override + public String azureRegion() { + return this.inner().azureRegion(); + } + + @Override + public String country() { + return this.inner().country(); + } + + @Override + public PeeringLocationPropertiesDirect direct() { + return this.inner().direct(); + } + + @Override + public PeeringLocationPropertiesExchange exchange() { + return this.inner().exchange(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Kind kind() { + return this.inner().kind(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String peeringLocation() { + return this.inner().peeringLocation(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringLocationInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringLocationInner.java new file mode 100644 index 0000000000000..43207d41beba6 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringLocationInner.java @@ -0,0 +1,181 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.management.peering.v2020_04_01.Kind; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringLocationPropertiesDirect; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringLocationPropertiesExchange; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Peering location is where connectivity could be established to the Microsoft + * Cloud Edge. + */ +@JsonFlatten +public class PeeringLocationInner extends ProxyResource { + /** + * The kind of peering that the peering location supports. Possible values + * include: 'Direct', 'Exchange'. + */ + @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 of peering that the peering location supports. Possible values include: 'Direct', 'Exchange'. + * + * @return the kind value + */ + public Kind kind() { + return this.kind; + } + + /** + * Set the kind of peering that the peering location supports. Possible values include: 'Direct', 'Exchange'. + * + * @param kind the kind value to set + * @return the PeeringLocationInner object itself. + */ + public PeeringLocationInner withKind(Kind kind) { + this.kind = kind; + return this; + } + + /** + * Get the properties that define a direct peering location. + * + * @return the direct value + */ + public PeeringLocationPropertiesDirect direct() { + return this.direct; + } + + /** + * Set 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 properties that define an exchange peering location. + * + * @return the exchange value + */ + public PeeringLocationPropertiesExchange exchange() { + return this.exchange; + } + + /** + * Set 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 name of the peering location. + * + * @return the peeringLocation value + */ + public String peeringLocation() { + return this.peeringLocation; + } + + /** + * Set 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 in which the peering location exists. + * + * @return the country value + */ + public String country() { + return this.country; + } + + /** + * Set 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 Azure region associated with the peering location. + * + * @return the azureRegion value + */ + public String azureRegion() { + return this.azureRegion; + } + + /** + * Set 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; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringLocationsImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringLocationsImpl.java new file mode 100644 index 0000000000000..71f63bfb12e8f --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringLocationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringLocations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringLocation; + +class PeeringLocationsImpl extends WrapperImpl implements PeeringLocations { + private final PeeringManager manager; + + PeeringLocationsImpl(PeeringManager manager) { + super(manager.inner().peeringLocations()); + this.manager = manager; + } + + public PeeringManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(final String kind) { + PeeringLocationsInner client = this.inner(); + return client.listAsync(kind) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PeeringLocation call(PeeringLocationInner inner) { + return new PeeringLocationImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringLocationsInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringLocationsInner.java new file mode 100644 index 0000000000000..207b24b78f4ef --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringLocationsInner.java @@ -0,0 +1,409 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.peering.v2020_04_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PeeringLocations. + */ +public class PeeringLocationsInner { + /** The Retrofit service to perform REST calls. */ + private PeeringLocationsService service; + /** The service client containing this operation class. */ + private PeeringManagementClientImpl client; + + /** + * Initializes an instance of PeeringLocationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PeeringLocationsInner(Retrofit retrofit, PeeringManagementClientImpl client) { + this.service = retrofit.create(PeeringLocationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PeeringLocations to be + * used by Retrofit to perform actually REST calls. + */ + interface PeeringLocationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.PeeringLocations list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringLocations") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("kind") String kind, @Query("directPeeringType") String directPeeringType, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.PeeringLocations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available peering locations for the specified kind of peering. + * + * @param kind The kind of the peering. Possible values include: 'Direct', 'Exchange' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringLocationInner> object if successful. + */ + public PagedList list(final String kind) { + ServiceResponse> response = listSinglePageAsync(kind).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available peering locations for the specified kind of peering. + * + * @param kind The kind of the peering. Possible values include: 'Direct', 'Exchange' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String kind, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(kind), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available peering locations for the specified kind of peering. + * + * @param kind The kind of the peering. Possible values include: 'Direct', 'Exchange' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringLocationInner> object + */ + public Observable> listAsync(final String kind) { + return listWithServiceResponseAsync(kind) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available peering locations for the specified kind of peering. + * + * @param kind The kind of the peering. Possible values include: 'Direct', 'Exchange' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringLocationInner> object + */ + public Observable>> listWithServiceResponseAsync(final String kind) { + return listSinglePageAsync(kind) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available peering locations for the specified kind of peering. + * + * @param kind The kind of the peering. Possible values include: 'Direct', 'Exchange' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringLocationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String kind) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (kind == null) { + throw new IllegalArgumentException("Parameter kind is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String directPeeringType = null; + return service.list(this.client.subscriptionId(), kind, directPeeringType, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all of the available peering locations for the specified kind of peering. + * + * @param kind The kind of the peering. Possible values include: 'Direct', 'Exchange' + * @param directPeeringType The type of direct peering. Possible values include: 'Edge', 'Transit', 'Cdn', 'Internal', 'Ix', 'IxRs' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringLocationInner> object if successful. + */ + public PagedList list(final String kind, final String directPeeringType) { + ServiceResponse> response = listSinglePageAsync(kind, directPeeringType).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available peering locations for the specified kind of peering. + * + * @param kind The kind of the peering. Possible values include: 'Direct', 'Exchange' + * @param directPeeringType The type of direct peering. Possible values include: 'Edge', 'Transit', 'Cdn', 'Internal', 'Ix', 'IxRs' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String kind, final String directPeeringType, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(kind, directPeeringType), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available peering locations for the specified kind of peering. + * + * @param kind The kind of the peering. Possible values include: 'Direct', 'Exchange' + * @param directPeeringType The type of direct peering. Possible values include: 'Edge', 'Transit', 'Cdn', 'Internal', 'Ix', 'IxRs' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringLocationInner> object + */ + public Observable> listAsync(final String kind, final String directPeeringType) { + return listWithServiceResponseAsync(kind, directPeeringType) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available peering locations for the specified kind of peering. + * + * @param kind The kind of the peering. Possible values include: 'Direct', 'Exchange' + * @param directPeeringType The type of direct peering. Possible values include: 'Edge', 'Transit', 'Cdn', 'Internal', 'Ix', 'IxRs' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringLocationInner> object + */ + public Observable>> listWithServiceResponseAsync(final String kind, final String directPeeringType) { + return listSinglePageAsync(kind, directPeeringType) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available peering locations for the specified kind of peering. + * + ServiceResponse> * @param kind The kind of the peering. Possible values include: 'Direct', 'Exchange' + ServiceResponse> * @param directPeeringType The type of direct peering. Possible values include: 'Edge', 'Transit', 'Cdn', 'Internal', 'Ix', 'IxRs' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringLocationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String kind, final String directPeeringType) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (kind == null) { + throw new IllegalArgumentException("Parameter kind is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), kind, directPeeringType, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the available peering locations for the specified kind of peering. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringLocationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available peering locations for the specified kind of peering. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available peering locations for the specified kind of peering. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringLocationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available peering locations for the specified kind of peering. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringLocationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available peering locations for the specified kind of peering. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringLocationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringManagementClientImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringManagementClientImpl.java new file mode 100644 index 0000000000000..f3cd0e8df3822 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringManagementClientImpl.java @@ -0,0 +1,481 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.management.peering.v2020_04_01.CheckServiceProviderAvailabilityInput; +import com.microsoft.azure.management.peering.v2020_04_01.ErrorResponseException; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * Initializes a new instance of the PeeringManagementClientImpl class. + */ +public class PeeringManagementClientImpl extends AzureServiceClient { + /** The Retrofit service to perform REST calls. */ + private PeeringManagementClientService service; + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The Azure subscription ID. */ + private String subscriptionId; + + /** + * Gets The Azure subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The Azure subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public PeeringManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The client API version. */ + private String apiVersion; + + /** + * Gets The client API version. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public PeeringManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public PeeringManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public PeeringManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The LegacyPeeringsInner object to access its operations. + */ + private LegacyPeeringsInner legacyPeerings; + + /** + * Gets the LegacyPeeringsInner object to access its operations. + * @return the LegacyPeeringsInner object. + */ + public LegacyPeeringsInner legacyPeerings() { + return this.legacyPeerings; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The PeerAsnsInner object to access its operations. + */ + private PeerAsnsInner peerAsns; + + /** + * Gets the PeerAsnsInner object to access its operations. + * @return the PeerAsnsInner object. + */ + public PeerAsnsInner peerAsns() { + return this.peerAsns; + } + + /** + * The PeeringLocationsInner object to access its operations. + */ + private PeeringLocationsInner peeringLocations; + + /** + * Gets the PeeringLocationsInner object to access its operations. + * @return the PeeringLocationsInner object. + */ + public PeeringLocationsInner peeringLocations() { + return this.peeringLocations; + } + + /** + * The RegisteredAsnsInner object to access its operations. + */ + private RegisteredAsnsInner registeredAsns; + + /** + * Gets the RegisteredAsnsInner object to access its operations. + * @return the RegisteredAsnsInner object. + */ + public RegisteredAsnsInner registeredAsns() { + return this.registeredAsns; + } + + /** + * The RegisteredPrefixesInner object to access its operations. + */ + private RegisteredPrefixesInner registeredPrefixes; + + /** + * Gets the RegisteredPrefixesInner object to access its operations. + * @return the RegisteredPrefixesInner object. + */ + public RegisteredPrefixesInner registeredPrefixes() { + return this.registeredPrefixes; + } + + /** + * The PeeringsInner object to access its operations. + */ + private PeeringsInner peerings; + + /** + * Gets the PeeringsInner object to access its operations. + * @return the PeeringsInner object. + */ + public PeeringsInner peerings() { + return this.peerings; + } + + /** + * The ReceivedRoutesInner object to access its operations. + */ + private ReceivedRoutesInner receivedRoutes; + + /** + * Gets the ReceivedRoutesInner object to access its operations. + * @return the ReceivedRoutesInner object. + */ + public ReceivedRoutesInner receivedRoutes() { + return this.receivedRoutes; + } + + /** + * The PeeringServiceCountriesInner object to access its operations. + */ + private PeeringServiceCountriesInner peeringServiceCountries; + + /** + * Gets the PeeringServiceCountriesInner object to access its operations. + * @return the PeeringServiceCountriesInner object. + */ + public PeeringServiceCountriesInner peeringServiceCountries() { + return this.peeringServiceCountries; + } + + /** + * The PeeringServiceLocationsInner object to access its operations. + */ + private PeeringServiceLocationsInner peeringServiceLocations; + + /** + * Gets the PeeringServiceLocationsInner object to access its operations. + * @return the PeeringServiceLocationsInner object. + */ + public PeeringServiceLocationsInner peeringServiceLocations() { + return this.peeringServiceLocations; + } + + /** + * The PrefixesInner object to access its operations. + */ + private PrefixesInner prefixes; + + /** + * Gets the PrefixesInner object to access its operations. + * @return the PrefixesInner object. + */ + public PrefixesInner prefixes() { + return this.prefixes; + } + + /** + * The PeeringServiceProvidersInner object to access its operations. + */ + private PeeringServiceProvidersInner peeringServiceProviders; + + /** + * Gets the PeeringServiceProvidersInner object to access its operations. + * @return the PeeringServiceProvidersInner object. + */ + public PeeringServiceProvidersInner peeringServiceProviders() { + return this.peeringServiceProviders; + } + + /** + * The PeeringServicesInner object to access its operations. + */ + private PeeringServicesInner peeringServices; + + /** + * Gets the PeeringServicesInner object to access its operations. + * @return the PeeringServicesInner object. + */ + public PeeringServicesInner peeringServices() { + return this.peeringServices; + } + + /** + * Initializes an instance of PeeringManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public PeeringManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of PeeringManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public PeeringManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of PeeringManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public PeeringManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2020-04-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.legacyPeerings = new LegacyPeeringsInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.peerAsns = new PeerAsnsInner(restClient().retrofit(), this); + this.peeringLocations = new PeeringLocationsInner(restClient().retrofit(), this); + this.registeredAsns = new RegisteredAsnsInner(restClient().retrofit(), this); + this.registeredPrefixes = new RegisteredPrefixesInner(restClient().retrofit(), this); + this.peerings = new PeeringsInner(restClient().retrofit(), this); + this.receivedRoutes = new ReceivedRoutesInner(restClient().retrofit(), this); + this.peeringServiceCountries = new PeeringServiceCountriesInner(restClient().retrofit(), this); + this.peeringServiceLocations = new PeeringServiceLocationsInner(restClient().retrofit(), this); + this.prefixes = new PrefixesInner(restClient().retrofit(), this); + this.peeringServiceProviders = new PeeringServiceProvidersInner(restClient().retrofit(), this); + this.peeringServices = new PeeringServicesInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + initializeService(); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "PeeringManagementClient", "2020-04-01"); + } + + private void initializeService() { + service = restClient().retrofit().create(PeeringManagementClientService.class); + } + + /** + * The interface defining all the services for PeeringManagementClient to be + * used by Retrofit to perform actually REST calls. + */ + interface PeeringManagementClientService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.PeeringManagementClient checkServiceProviderAvailability" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Peering/CheckServiceProviderAvailability") + Observable> checkServiceProviderAvailability(@Path("subscriptionId") String subscriptionId, @Body CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the String object if successful. + */ + public String checkServiceProviderAvailability(CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput) { + return checkServiceProviderAvailabilityWithServiceResponseAsync(checkServiceProviderAvailabilityInput).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture checkServiceProviderAvailabilityAsync(CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkServiceProviderAvailabilityWithServiceResponseAsync(checkServiceProviderAvailabilityInput), serviceCallback); + } + + /** + * 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 + * @return the observable to the String object + */ + public Observable checkServiceProviderAvailabilityAsync(CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput) { + return checkServiceProviderAvailabilityWithServiceResponseAsync(checkServiceProviderAvailabilityInput).map(new Func1, String>() { + @Override + public String call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the String object + */ + public Observable> checkServiceProviderAvailabilityWithServiceResponseAsync(CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput) { + if (this.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null."); + } + if (checkServiceProviderAvailabilityInput == null) { + throw new IllegalArgumentException("Parameter checkServiceProviderAvailabilityInput is required and cannot be null."); + } + if (this.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); + } + Validator.validate(checkServiceProviderAvailabilityInput); + return service.checkServiceProviderAvailability(this.subscriptionId(), checkServiceProviderAvailabilityInput, this.apiVersion(), this.acceptLanguage(), this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkServiceProviderAvailabilityDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkServiceProviderAvailabilityDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringManager.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringManager.java new file mode 100644 index 0000000000000..72ea32c23bac7 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringManager.java @@ -0,0 +1,243 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.peering.v2020_04_01.LegacyPeerings; +import com.microsoft.azure.management.peering.v2020_04_01.Operations; +import com.microsoft.azure.management.peering.v2020_04_01.PeerAsns; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringLocations; +import com.microsoft.azure.management.peering.v2020_04_01.RegisteredAsns; +import com.microsoft.azure.management.peering.v2020_04_01.RegisteredPrefixes; +import com.microsoft.azure.management.peering.v2020_04_01.Peerings; +import com.microsoft.azure.management.peering.v2020_04_01.ReceivedRoutes; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringServiceCountries; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringServiceLocations; +import com.microsoft.azure.management.peering.v2020_04_01.Prefixes; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringServiceProviders; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringServices; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Peering resource management. + */ +public final class PeeringManager extends ManagerCore { + 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; + /** + * Get a Configurable instance that can be used to create PeeringManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new PeeringManager.ConfigurableImpl(); + } + /** + * Creates an instance of PeeringManager that exposes Peering resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the PeeringManager + */ + public static PeeringManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new PeeringManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of PeeringManager that exposes Peering resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the PeeringManager + */ + public static PeeringManager authenticate(RestClient restClient, String subscriptionId) { + return new PeeringManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of PeeringManager that exposes Peering management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Peering management API entry points that work across subscriptions + */ + PeeringManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage LegacyPeerings. + */ + public LegacyPeerings legacyPeerings() { + if (this.legacyPeerings == null) { + this.legacyPeerings = new LegacyPeeringsImpl(this); + } + return this.legacyPeerings; + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage PeerAsns. + */ + public PeerAsns peerAsns() { + if (this.peerAsns == null) { + this.peerAsns = new PeerAsnsImpl(this); + } + return this.peerAsns; + } + + /** + * @return Entry point to manage PeeringLocations. + */ + public PeeringLocations peeringLocations() { + if (this.peeringLocations == null) { + this.peeringLocations = new PeeringLocationsImpl(this); + } + return this.peeringLocations; + } + + /** + * @return Entry point to manage RegisteredAsns. + */ + public RegisteredAsns registeredAsns() { + if (this.registeredAsns == null) { + this.registeredAsns = new RegisteredAsnsImpl(this); + } + return this.registeredAsns; + } + + /** + * @return Entry point to manage RegisteredPrefixes. + */ + public RegisteredPrefixes registeredPrefixes() { + if (this.registeredPrefixes == null) { + this.registeredPrefixes = new RegisteredPrefixesImpl(this); + } + return this.registeredPrefixes; + } + + /** + * @return Entry point to manage Peerings. + */ + public Peerings peerings() { + if (this.peerings == null) { + this.peerings = new PeeringsImpl(this); + } + return this.peerings; + } + + /** + * @return Entry point to manage ReceivedRoutes. + */ + public ReceivedRoutes receivedRoutes() { + if (this.receivedRoutes == null) { + this.receivedRoutes = new ReceivedRoutesImpl(this); + } + return this.receivedRoutes; + } + + /** + * @return Entry point to manage PeeringServiceCountries. + */ + public PeeringServiceCountries peeringServiceCountries() { + if (this.peeringServiceCountries == null) { + this.peeringServiceCountries = new PeeringServiceCountriesImpl(this); + } + return this.peeringServiceCountries; + } + + /** + * @return Entry point to manage PeeringServiceLocations. + */ + public PeeringServiceLocations peeringServiceLocations() { + if (this.peeringServiceLocations == null) { + this.peeringServiceLocations = new PeeringServiceLocationsImpl(this); + } + return this.peeringServiceLocations; + } + + /** + * @return Entry point to manage Prefixes. + */ + public Prefixes prefixes() { + if (this.prefixes == null) { + this.prefixes = new PrefixesImpl(this); + } + return this.prefixes; + } + + /** + * @return Entry point to manage PeeringServiceProviders. + */ + public PeeringServiceProviders peeringServiceProviders() { + if (this.peeringServiceProviders == null) { + this.peeringServiceProviders = new PeeringServiceProvidersImpl(this); + } + return this.peeringServiceProviders; + } + + /** + * @return Entry point to manage PeeringServices. + */ + public PeeringServices peeringServices() { + if (this.peeringServices == null) { + this.peeringServices = new PeeringServicesImpl(this); + } + return this.peeringServices; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public PeeringManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return PeeringManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private PeeringManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new PeeringManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringReceivedRouteImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringReceivedRouteImpl.java new file mode 100644 index 0000000000000..fc4b00030fa22 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringReceivedRouteImpl.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.management.peering.v2020_04_01.PeeringReceivedRoute; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; + +class PeeringReceivedRouteImpl extends WrapperImpl implements PeeringReceivedRoute { + private final PeeringManager manager; + + PeeringReceivedRouteImpl(PeeringReceivedRouteInner inner, PeeringManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public PeeringManager manager() { + return this.manager; + } + + + + @Override + public String asPath() { + return this.inner().asPath(); + } + + @Override + public String nextHop() { + return this.inner().nextHop(); + } + + @Override + public String originAsValidationState() { + return this.inner().originAsValidationState(); + } + + @Override + public String prefix() { + return this.inner().prefix(); + } + + @Override + public String receivedTimestamp() { + return this.inner().receivedTimestamp(); + } + + @Override + public String rpkiValidationState() { + return this.inner().rpkiValidationState(); + } + + @Override + public String trustAnchor() { + return this.inner().trustAnchor(); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringReceivedRouteInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringReceivedRouteInner.java new file mode 100644 index 0000000000000..a979937388b5e --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringReceivedRouteInner.java @@ -0,0 +1,124 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties that define a received route. + */ +public class PeeringReceivedRouteInner { + /** + * 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. + * + * @return the prefix value + */ + public String prefix() { + return this.prefix; + } + + /** + * Get the next hop for the prefix. + * + * @return the nextHop value + */ + public String nextHop() { + return this.nextHop; + } + + /** + * Get the AS path for the prefix. + * + * @return the asPath value + */ + public String asPath() { + return this.asPath; + } + + /** + * Get the origin AS change information for the prefix. + * + * @return the originAsValidationState value + */ + public String originAsValidationState() { + return this.originAsValidationState; + } + + /** + * Get 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 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 received timestamp associated with the prefix. + * + * @return the receivedTimestamp value + */ + public String receivedTimestamp() { + return this.receivedTimestamp; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringRegisteredAsnImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringRegisteredAsnImpl.java new file mode 100644 index 0000000000000..a001c04c44177 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringRegisteredAsnImpl.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.management.peering.v2020_04_01.PeeringRegisteredAsn; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.peering.v2020_04_01.ProvisioningState; + +class PeeringRegisteredAsnImpl extends CreatableUpdatableImpl implements PeeringRegisteredAsn, PeeringRegisteredAsn.Definition, PeeringRegisteredAsn.Update { + private final PeeringManager manager; + private String resourceGroupName; + private String peeringName; + private String registeredAsnName; + private Integer casn; + private Integer uasn; + + PeeringRegisteredAsnImpl(String name, PeeringManager manager) { + super(name, new PeeringRegisteredAsnInner()); + this.manager = manager; + // Set resource name + this.registeredAsnName = name; + // + } + + PeeringRegisteredAsnImpl(PeeringRegisteredAsnInner inner, PeeringManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.registeredAsnName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.peeringName = IdParsingUtils.getValueFromIdByName(inner.id(), "peerings"); + this.registeredAsnName = IdParsingUtils.getValueFromIdByName(inner.id(), "registeredAsns"); + // + } + + @Override + public PeeringManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + RegisteredAsnsInner client = this.manager().inner().registeredAsns(); + return client.createOrUpdateAsync(this.resourceGroupName, this.peeringName, this.registeredAsnName, this.casn) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + RegisteredAsnsInner client = this.manager().inner().registeredAsns(); + return client.createOrUpdateAsync(this.resourceGroupName, this.peeringName, this.registeredAsnName, this.uasn) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + RegisteredAsnsInner client = this.manager().inner().registeredAsns(); + return client.getAsync(this.resourceGroupName, this.peeringName, this.registeredAsnName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public Integer asn() { + return this.inner().asn(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String peeringServicePrefixKey() { + return this.inner().peeringServicePrefixKey(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public PeeringRegisteredAsnImpl withExistingPeering(String resourceGroupName, String peeringName) { + this.resourceGroupName = resourceGroupName; + this.peeringName = peeringName; + return this; + } + + @Override + public PeeringRegisteredAsnImpl withAsn(Integer asn) { + if (isInCreateMode()) { + this.casn = asn; + } else { + this.uasn = asn; + } + return this; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringRegisteredAsnInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringRegisteredAsnInner.java new file mode 100644 index 0000000000000..650fce047c38a --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringRegisteredAsnInner.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.management.peering.v2020_04_01.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The customer's ASN that is registered by the peering service provider. + */ +@JsonFlatten +public class PeeringRegisteredAsnInner extends ProxyResource { + /** + * 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. Possible values include: + * 'Succeeded', 'Updating', 'Deleting', 'Failed'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the customer's ASN from which traffic originates. + * + * @return the asn value + */ + public Integer asn() { + return this.asn; + } + + /** + * Set 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 peering service prefix key that is to be shared with the customer. + * + * @return the peeringServicePrefixKey value + */ + public String peeringServicePrefixKey() { + return this.peeringServicePrefixKey; + } + + /** + * Get the provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringRegisteredPrefixImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringRegisteredPrefixImpl.java new file mode 100644 index 0000000000000..6142eb42ee20e --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringRegisteredPrefixImpl.java @@ -0,0 +1,133 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.management.peering.v2020_04_01.PeeringRegisteredPrefix; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.peering.v2020_04_01.PrefixValidationState; +import com.microsoft.azure.management.peering.v2020_04_01.ProvisioningState; + +class PeeringRegisteredPrefixImpl extends CreatableUpdatableImpl implements PeeringRegisteredPrefix, PeeringRegisteredPrefix.Definition, PeeringRegisteredPrefix.Update { + private final PeeringManager manager; + private String resourceGroupName; + private String peeringName; + private String registeredPrefixName; + private String cprefix; + private String uprefix; + + PeeringRegisteredPrefixImpl(String name, PeeringManager manager) { + super(name, new PeeringRegisteredPrefixInner()); + this.manager = manager; + // Set resource name + this.registeredPrefixName = name; + // + } + + PeeringRegisteredPrefixImpl(PeeringRegisteredPrefixInner inner, PeeringManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.registeredPrefixName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.peeringName = IdParsingUtils.getValueFromIdByName(inner.id(), "peerings"); + this.registeredPrefixName = IdParsingUtils.getValueFromIdByName(inner.id(), "registeredPrefixes"); + // + } + + @Override + public PeeringManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + RegisteredPrefixesInner client = this.manager().inner().registeredPrefixes(); + return client.createOrUpdateAsync(this.resourceGroupName, this.peeringName, this.registeredPrefixName, this.cprefix) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + RegisteredPrefixesInner client = this.manager().inner().registeredPrefixes(); + return client.createOrUpdateAsync(this.resourceGroupName, this.peeringName, this.registeredPrefixName, this.uprefix) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + RegisteredPrefixesInner client = this.manager().inner().registeredPrefixes(); + return client.getAsync(this.resourceGroupName, this.peeringName, this.registeredPrefixName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String errorMessage() { + return this.inner().errorMessage(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String peeringServicePrefixKey() { + return this.inner().peeringServicePrefixKey(); + } + + @Override + public String prefix() { + return this.inner().prefix(); + } + + @Override + public PrefixValidationState prefixValidationState() { + return this.inner().prefixValidationState(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public PeeringRegisteredPrefixImpl withExistingPeering(String resourceGroupName, String peeringName) { + this.resourceGroupName = resourceGroupName; + this.peeringName = peeringName; + return this; + } + + @Override + public PeeringRegisteredPrefixImpl withPrefix(String prefix) { + if (isInCreateMode()) { + this.cprefix = prefix; + } else { + this.uprefix = prefix; + } + return this; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringRegisteredPrefixInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringRegisteredPrefixInner.java new file mode 100644 index 0000000000000..4a55699d545a1 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringRegisteredPrefixInner.java @@ -0,0 +1,110 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.management.peering.v2020_04_01.PrefixValidationState; +import com.microsoft.azure.management.peering.v2020_04_01.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The customer's prefix that is registered by the peering service provider. + */ +@JsonFlatten +public class PeeringRegisteredPrefixInner extends ProxyResource { + /** + * The customer's prefix from which traffic originates. + */ + @JsonProperty(value = "properties.prefix") + private String prefix; + + /** + * The prefix validation state. Possible values include: 'None', 'Invalid', + * 'Verified', 'Failed', 'Pending', 'Warning', 'Unknown'. + */ + @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. Possible values include: + * 'Succeeded', 'Updating', 'Deleting', 'Failed'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the customer's prefix from which traffic originates. + * + * @return the prefix value + */ + public String prefix() { + return this.prefix; + } + + /** + * Set 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 prefix validation state. Possible values include: 'None', 'Invalid', 'Verified', 'Failed', 'Pending', 'Warning', 'Unknown'. + * + * @return the prefixValidationState value + */ + public PrefixValidationState prefixValidationState() { + return this.prefixValidationState; + } + + /** + * Get 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 error message associated with the validation state, if any. + * + * @return the errorMessage value + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceCountriesImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceCountriesImpl.java new file mode 100644 index 0000000000000..24c482f147ffc --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceCountriesImpl.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * jkl + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringServiceCountries; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.arm.utils.PagedListConverter; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringServiceCountry; + +class PeeringServiceCountriesImpl extends WrapperImpl implements PeeringServiceCountries { + private PagedListConverter converter; + private final PeeringManager manager; + + PeeringServiceCountriesImpl(PeeringManager manager) { + super(manager.inner().peeringServiceCountries()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(PeeringServiceCountryInner inner) { + return Observable.just((PeeringServiceCountry) wrapModel(inner)); + } + }; + } + + public PeeringManager manager() { + return this.manager; + } + + private PeeringServiceCountryImpl wrapModel(PeeringServiceCountryInner inner) { + return new PeeringServiceCountryImpl(inner, manager()); + } + + @Override + public PagedList list() { + PeeringServiceCountriesInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + PeeringServiceCountriesInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PeeringServiceCountry call(PeeringServiceCountryInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceCountriesInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceCountriesInner.java new file mode 100644 index 0000000000000..62448bd1590cf --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceCountriesInner.java @@ -0,0 +1,287 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.peering.v2020_04_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PeeringServiceCountries. + */ +public class PeeringServiceCountriesInner { + /** The Retrofit service to perform REST calls. */ + private PeeringServiceCountriesService service; + /** The service client containing this operation class. */ + private PeeringManagementClientImpl client; + + /** + * Initializes an instance of PeeringServiceCountriesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PeeringServiceCountriesInner(Retrofit retrofit, PeeringManagementClientImpl client) { + this.service = retrofit.create(PeeringServiceCountriesService.class); + this.client = client; + } + + /** + * The interface defining all the services for PeeringServiceCountries to be + * used by Retrofit to perform actually REST calls. + */ + interface PeeringServiceCountriesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.PeeringServiceCountries list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceCountries") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.PeeringServiceCountries listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available countries for peering service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringServiceCountryInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available countries for peering service. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available countries for peering service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringServiceCountryInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available countries for peering service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringServiceCountryInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available countries for peering service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringServiceCountryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the available countries for peering service. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringServiceCountryInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available countries for peering service. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available countries for peering service. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringServiceCountryInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available countries for peering service. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringServiceCountryInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available countries for peering service. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringServiceCountryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceCountryImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceCountryImpl.java new file mode 100644 index 0000000000000..ebfb3977a7b3a --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceCountryImpl.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.management.peering.v2020_04_01.PeeringServiceCountry; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; + +class PeeringServiceCountryImpl extends WrapperImpl implements PeeringServiceCountry { + private final PeeringManager manager; + + PeeringServiceCountryImpl(PeeringServiceCountryInner inner, PeeringManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public PeeringManager manager() { + return this.manager; + } + + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceCountryInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceCountryInner.java new file mode 100644 index 0000000000000..0672ade1c4103 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceCountryInner.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.ProxyResource; + +/** + * The peering service country. + */ +public class PeeringServiceCountryInner extends ProxyResource { +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceImpl.java new file mode 100644 index 0000000000000..fa4b1e4aec925 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceImpl.java @@ -0,0 +1,86 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringService; +import rx.Observable; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringServiceSku; +import com.microsoft.azure.management.peering.v2020_04_01.ProvisioningState; + +class PeeringServiceImpl extends GroupableResourceCoreImpl implements PeeringService, PeeringService.Definition, PeeringService.Update { + PeeringServiceImpl(String name, PeeringServiceInner inner, PeeringManager manager) { + super(name, inner, manager); + } + + @Override + public Observable createResourceAsync() { + PeeringServicesInner client = this.manager().inner().peeringServices(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + PeeringServicesInner client = this.manager().inner().peeringServices(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + PeeringServicesInner client = this.manager().inner().peeringServices(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String peeringServiceLocation() { + return this.inner().peeringServiceLocation(); + } + + @Override + public String peeringServiceProvider() { + return this.inner().peeringServiceProvider(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public PeeringServiceSku sku() { + return this.inner().sku(); + } + + @Override + public PeeringServiceImpl withPeeringServiceLocation(String peeringServiceLocation) { + this.inner().withPeeringServiceLocation(peeringServiceLocation); + return this; + } + + @Override + public PeeringServiceImpl withPeeringServiceProvider(String peeringServiceProvider) { + this.inner().withPeeringServiceProvider(peeringServiceProvider); + return this; + } + + @Override + public PeeringServiceImpl withSku(PeeringServiceSku sku) { + this.inner().withSku(sku); + return this; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceInner.java new file mode 100644 index 0000000000000..e08b3dc024c93 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceInner.java @@ -0,0 +1,169 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.management.peering.v2020_04_01.PeeringServiceSku; +import com.microsoft.azure.management.peering.v2020_04_01.ProvisioningState; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Peering Service. + */ +@JsonFlatten +public class PeeringServiceInner extends ProxyResource { + /** + * The SKU that defines the type of the peering service. + */ + @JsonProperty(value = "sku") + private PeeringServiceSku sku; + + /** + * The PeeringServiceLocation of the Customer. + */ + @JsonProperty(value = "properties.peeringServiceLocation") + private String peeringServiceLocation; + + /** + * The MAPS Provider Name. + */ + @JsonProperty(value = "properties.peeringServiceProvider") + private String peeringServiceProvider; + + /** + * The provisioning state of the resource. Possible values include: + * 'Succeeded', 'Updating', 'Deleting', 'Failed'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * The location of the resource. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * The resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the SKU that defines the type of the peering service. + * + * @return the sku value + */ + public PeeringServiceSku sku() { + return this.sku; + } + + /** + * Set 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 PeeringServiceLocation of the Customer. + * + * @return the peeringServiceLocation value + */ + public String peeringServiceLocation() { + return this.peeringServiceLocation; + } + + /** + * Set the PeeringServiceLocation of the Customer. + * + * @param peeringServiceLocation the peeringServiceLocation value to set + * @return the PeeringServiceInner object itself. + */ + public PeeringServiceInner withPeeringServiceLocation(String peeringServiceLocation) { + this.peeringServiceLocation = peeringServiceLocation; + return this; + } + + /** + * Get the MAPS Provider Name. + * + * @return the peeringServiceProvider value + */ + public String peeringServiceProvider() { + return this.peeringServiceProvider; + } + + /** + * Set the MAPS Provider Name. + * + * @param peeringServiceProvider the peeringServiceProvider value to set + * @return the PeeringServiceInner object itself. + */ + public PeeringServiceInner withPeeringServiceProvider(String peeringServiceProvider) { + this.peeringServiceProvider = peeringServiceProvider; + return this; + } + + /** + * Get the provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the location of the resource. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set 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 resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set 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; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceLocationImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceLocationImpl.java new file mode 100644 index 0000000000000..46f72d7307e0b --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceLocationImpl.java @@ -0,0 +1,61 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.management.peering.v2020_04_01.PeeringServiceLocation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; + +class PeeringServiceLocationImpl extends WrapperImpl implements PeeringServiceLocation { + private final PeeringManager manager; + + PeeringServiceLocationImpl(PeeringServiceLocationInner inner, PeeringManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public PeeringManager manager() { + return this.manager; + } + + + + @Override + public String azureRegion() { + return this.inner().azureRegion(); + } + + @Override + public String country() { + return this.inner().country(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String state() { + return this.inner().state(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceLocationInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceLocationInner.java new file mode 100644 index 0000000000000..5712b124f3f75 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceLocationInner.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The peering service location. + */ +@JsonFlatten +public class PeeringServiceLocationInner extends ProxyResource { + /** + * 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 country of the customer. + * + * @return the country value + */ + public String country() { + return this.country; + } + + /** + * Set 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 state of the customer. + * + * @return the state value + */ + public String state() { + return this.state; + } + + /** + * Set 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 azure region for the location. + * + * @return the azureRegion value + */ + public String azureRegion() { + return this.azureRegion; + } + + /** + * Set 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; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceLocationsImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceLocationsImpl.java new file mode 100644 index 0000000000000..1af3f0542aa3f --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceLocationsImpl.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * jkl + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringServiceLocations; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.arm.utils.PagedListConverter; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringServiceLocation; + +class PeeringServiceLocationsImpl extends WrapperImpl implements PeeringServiceLocations { + private PagedListConverter converter; + private final PeeringManager manager; + + PeeringServiceLocationsImpl(PeeringManager manager) { + super(manager.inner().peeringServiceLocations()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(PeeringServiceLocationInner inner) { + return Observable.just((PeeringServiceLocation) wrapModel(inner)); + } + }; + } + + public PeeringManager manager() { + return this.manager; + } + + private PeeringServiceLocationImpl wrapModel(PeeringServiceLocationInner inner) { + return new PeeringServiceLocationImpl(inner, manager()); + } + + @Override + public PagedList list() { + PeeringServiceLocationsInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + PeeringServiceLocationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PeeringServiceLocation call(PeeringServiceLocationInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceLocationsInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceLocationsInner.java new file mode 100644 index 0000000000000..a3c15da4915ca --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceLocationsInner.java @@ -0,0 +1,393 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.peering.v2020_04_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PeeringServiceLocations. + */ +public class PeeringServiceLocationsInner { + /** The Retrofit service to perform REST calls. */ + private PeeringServiceLocationsService service; + /** The service client containing this operation class. */ + private PeeringManagementClientImpl client; + + /** + * Initializes an instance of PeeringServiceLocationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PeeringServiceLocationsInner(Retrofit retrofit, PeeringManagementClientImpl client) { + this.service = retrofit.create(PeeringServiceLocationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PeeringServiceLocations to be + * used by Retrofit to perform actually REST calls. + */ + interface PeeringServiceLocationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.PeeringServiceLocations list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceLocations") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("country") String country, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.PeeringServiceLocations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available locations for peering service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringServiceLocationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available locations for peering service. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available locations for peering service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringServiceLocationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available locations for peering service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringServiceLocationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available locations for peering service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringServiceLocationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String country = null; + return service.list(this.client.subscriptionId(), country, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringServiceLocationInner> object if successful. + */ + public PagedList list(final String country) { + ServiceResponse> response = listSinglePageAsync(country).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available locations for peering service. + * + * @param country The country of interest, in which the locations are to be present. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String country, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(country), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * 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 + * @return the observable to the PagedList<PeeringServiceLocationInner> object + */ + public Observable> listAsync(final String country) { + return listWithServiceResponseAsync(country) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the PagedList<PeeringServiceLocationInner> object + */ + public Observable>> listWithServiceResponseAsync(final String country) { + return listSinglePageAsync(country) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available locations for peering service. + * + ServiceResponse> * @param country The country of interest, in which the locations are to be present. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringServiceLocationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String country) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), country, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the available locations for peering service. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringServiceLocationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available locations for peering service. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available locations for peering service. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringServiceLocationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available locations for peering service. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringServiceLocationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available locations for peering service. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringServiceLocationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServicePrefixImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServicePrefixImpl.java new file mode 100644 index 0000000000000..b84a55a86047e --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServicePrefixImpl.java @@ -0,0 +1,146 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.management.peering.v2020_04_01.PeeringServicePrefix; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.peering.v2020_04_01.PrefixValidationState; +import com.microsoft.azure.management.peering.v2020_04_01.LearnedType; +import java.util.List; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringServicePrefixEvent; +import com.microsoft.azure.management.peering.v2020_04_01.ProvisioningState; + +class PeeringServicePrefixImpl extends CreatableUpdatableImpl implements PeeringServicePrefix, PeeringServicePrefix.Definition, PeeringServicePrefix.Update { + private final PeeringManager manager; + private String resourceGroupName; + private String peeringServiceName; + private String prefixName; + + PeeringServicePrefixImpl(String name, PeeringManager manager) { + super(name, new PeeringServicePrefixInner()); + this.manager = manager; + // Set resource name + this.prefixName = name; + // + } + + PeeringServicePrefixImpl(PeeringServicePrefixInner inner, PeeringManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.prefixName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.peeringServiceName = IdParsingUtils.getValueFromIdByName(inner.id(), "peeringServices"); + this.prefixName = IdParsingUtils.getValueFromIdByName(inner.id(), "prefixes"); + // + } + + @Override + public PeeringManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + PrefixesInner client = this.manager().inner().prefixes(); + return client.createOrUpdateAsync(this.resourceGroupName, this.peeringServiceName, this.prefixName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + PrefixesInner client = this.manager().inner().prefixes(); + return client.createOrUpdateAsync(this.resourceGroupName, this.peeringServiceName, this.prefixName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + PrefixesInner client = this.manager().inner().prefixes(); + return client.getAsync(this.resourceGroupName, this.peeringServiceName, this.prefixName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String errorMessage() { + return this.inner().errorMessage(); + } + + @Override + public List events() { + return this.inner().events(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public LearnedType learnedType() { + return this.inner().learnedType(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String peeringServicePrefixKey() { + return this.inner().peeringServicePrefixKey(); + } + + @Override + public String prefix() { + return this.inner().prefix(); + } + + @Override + public PrefixValidationState prefixValidationState() { + return this.inner().prefixValidationState(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public PeeringServicePrefixImpl withExistingPeeringService(String resourceGroupName, String peeringServiceName) { + this.resourceGroupName = resourceGroupName; + this.peeringServiceName = peeringServiceName; + return this; + } + + @Override + public PeeringServicePrefixImpl withPeeringServicePrefixKey(String peeringServicePrefixKey) { + this.inner().withPeeringServicePrefixKey(peeringServicePrefixKey); + return this; + } + + @Override + public PeeringServicePrefixImpl withPrefix(String prefix) { + this.inner().withPrefix(prefix); + return this; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServicePrefixInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServicePrefixInner.java new file mode 100644 index 0000000000000..052ceceb47da6 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServicePrefixInner.java @@ -0,0 +1,155 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.management.peering.v2020_04_01.PrefixValidationState; +import com.microsoft.azure.management.peering.v2020_04_01.LearnedType; +import java.util.List; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringServicePrefixEvent; +import com.microsoft.azure.management.peering.v2020_04_01.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The peering service prefix class. + */ +@JsonFlatten +public class PeeringServicePrefixInner extends ProxyResource { + /** + * The prefix from which your traffic originates. + */ + @JsonProperty(value = "properties.prefix") + private String prefix; + + /** + * The prefix validation state. Possible values include: 'None', 'Invalid', + * 'Verified', 'Failed', 'Pending', 'Warning', 'Unknown'. + */ + @JsonProperty(value = "properties.prefixValidationState", access = JsonProperty.Access.WRITE_ONLY) + private PrefixValidationState prefixValidationState; + + /** + * The prefix learned type. Possible values include: 'None', + * 'ViaServiceProvider', 'ViaSession'. + */ + @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. Possible values include: + * 'Succeeded', 'Updating', 'Deleting', 'Failed'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the prefix from which your traffic originates. + * + * @return the prefix value + */ + public String prefix() { + return this.prefix; + } + + /** + * Set 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 prefix validation state. Possible values include: 'None', 'Invalid', 'Verified', 'Failed', 'Pending', 'Warning', 'Unknown'. + * + * @return the prefixValidationState value + */ + public PrefixValidationState prefixValidationState() { + return this.prefixValidationState; + } + + /** + * Get the prefix learned type. Possible values include: 'None', 'ViaServiceProvider', 'ViaSession'. + * + * @return the learnedType value + */ + public LearnedType learnedType() { + return this.learnedType; + } + + /** + * Get the error message for validation state. + * + * @return the errorMessage value + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the list of events for peering service prefix. + * + * @return the events value + */ + public List events() { + return this.events; + } + + /** + * Get the peering service prefix key. + * + * @return the peeringServicePrefixKey value + */ + public String peeringServicePrefixKey() { + return this.peeringServicePrefixKey; + } + + /** + * Set 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 provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceProviderImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceProviderImpl.java new file mode 100644 index 0000000000000..10d5d07e01101 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceProviderImpl.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.management.peering.v2020_04_01.PeeringServiceProvider; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; + +class PeeringServiceProviderImpl extends WrapperImpl implements PeeringServiceProvider { + private final PeeringManager manager; + + PeeringServiceProviderImpl(PeeringServiceProviderInner inner, PeeringManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public PeeringManager manager() { + return this.manager; + } + + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String serviceProviderName() { + return this.inner().serviceProviderName(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceProviderInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceProviderInner.java new file mode 100644 index 0000000000000..3dbb150fb91cf --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceProviderInner.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * PeeringService provider. + */ +@JsonFlatten +public class PeeringServiceProviderInner extends ProxyResource { + /** + * The name of the service provider. + */ + @JsonProperty(value = "properties.serviceProviderName") + private String serviceProviderName; + + /** + * Get the name of the service provider. + * + * @return the serviceProviderName value + */ + public String serviceProviderName() { + return this.serviceProviderName; + } + + /** + * Set 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; + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceProvidersImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceProvidersImpl.java new file mode 100644 index 0000000000000..86147c9a06007 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceProvidersImpl.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * jkl + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringServiceProviders; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.arm.utils.PagedListConverter; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringServiceProvider; + +class PeeringServiceProvidersImpl extends WrapperImpl implements PeeringServiceProviders { + private PagedListConverter converter; + private final PeeringManager manager; + + PeeringServiceProvidersImpl(PeeringManager manager) { + super(manager.inner().peeringServiceProviders()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(PeeringServiceProviderInner inner) { + return Observable.just((PeeringServiceProvider) wrapModel(inner)); + } + }; + } + + public PeeringManager manager() { + return this.manager; + } + + private PeeringServiceProviderImpl wrapModel(PeeringServiceProviderInner inner) { + return new PeeringServiceProviderImpl(inner, manager()); + } + + @Override + public PagedList list() { + PeeringServiceProvidersInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + PeeringServiceProvidersInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PeeringServiceProvider call(PeeringServiceProviderInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceProvidersInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceProvidersInner.java new file mode 100644 index 0000000000000..0ec92e2ce7be6 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServiceProvidersInner.java @@ -0,0 +1,287 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.peering.v2020_04_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PeeringServiceProviders. + */ +public class PeeringServiceProvidersInner { + /** The Retrofit service to perform REST calls. */ + private PeeringServiceProvidersService service; + /** The service client containing this operation class. */ + private PeeringManagementClientImpl client; + + /** + * Initializes an instance of PeeringServiceProvidersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PeeringServiceProvidersInner(Retrofit retrofit, PeeringManagementClientImpl client) { + this.service = retrofit.create(PeeringServiceProvidersService.class); + this.client = client; + } + + /** + * The interface defining all the services for PeeringServiceProviders to be + * used by Retrofit to perform actually REST calls. + */ + interface PeeringServiceProvidersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.PeeringServiceProviders list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceProviders") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.PeeringServiceProviders listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringServiceProviderInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringServiceProviderInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringServiceProviderInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringServiceProviderInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringServiceProviderInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringServiceProviderInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringServiceProviderInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available peering service locations for the specified kind of peering. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringServiceProviderInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServicesImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServicesImpl.java new file mode 100644 index 0000000000000..a6cf153acd1f8 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServicesImpl.java @@ -0,0 +1,138 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * def + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringServices; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringService; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; + +class PeeringServicesImpl extends GroupableResourcesCoreImpl implements PeeringServices { + protected PeeringServicesImpl(PeeringManager manager) { + super(manager.inner().peeringServices(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + PeeringServicesInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + PeeringServicesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + PeeringServicesInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + PeeringServicesInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PeeringService call(PeeringServiceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + PeeringServicesInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + PeeringServicesInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PeeringService call(PeeringServiceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PeeringServiceImpl define(String name) { + return wrapModel(name); + } + + @Override + protected PeeringServiceImpl wrapModel(PeeringServiceInner inner) { + return new PeeringServiceImpl(inner.name(), inner, manager()); + } + + @Override + protected PeeringServiceImpl wrapModel(String name) { + return new PeeringServiceImpl(name, new PeeringServiceInner(), this.manager()); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServicesInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServicesInner.java new file mode 100644 index 0000000000000..211e5fa8002e3 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringServicesInner.java @@ -0,0 +1,990 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.peering.v2020_04_01.ErrorResponseException; +import com.microsoft.azure.management.peering.v2020_04_01.ResourceTags; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PeeringServices. + */ +public class PeeringServicesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private PeeringServicesService service; + /** The service client containing this operation class. */ + private PeeringManagementClientImpl client; + + /** + * Initializes an instance of PeeringServicesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PeeringServicesInner(Retrofit retrofit, PeeringManagementClientImpl client) { + this.service = retrofit.create(PeeringServicesService.class); + this.client = client; + } + + /** + * The interface defining all the services for PeeringServices to be + * used by Retrofit to perform actually REST calls. + */ + interface PeeringServicesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.PeeringServices getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("peeringServiceName") String peeringServiceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.PeeringServices createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("peeringServiceName") String peeringServiceName, @Path("subscriptionId") String subscriptionId, @Body PeeringServiceInner peeringService, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.PeeringServices delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("peeringServiceName") String peeringServiceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.PeeringServices update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("peeringServiceName") String peeringServiceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ResourceTags tags, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.PeeringServices listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.PeeringServices list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServices") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.PeeringServices listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.PeeringServices listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PeeringServiceInner object if successful. + */ + public PeeringServiceInner getByResourceGroup(String resourceGroupName, String peeringServiceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, peeringServiceName).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String peeringServiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, peeringServiceName), serviceCallback); + } + + /** + * 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 + * @return the observable to the PeeringServiceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String peeringServiceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, peeringServiceName).map(new Func1, PeeringServiceInner>() { + @Override + public PeeringServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the PeeringServiceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String peeringServiceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringServiceName == null) { + throw new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(resourceGroupName, peeringServiceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PeeringServiceInner object if successful. + */ + public PeeringServiceInner createOrUpdate(String resourceGroupName, String peeringServiceName, PeeringServiceInner peeringService) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, peeringServiceName, peeringService).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String peeringServiceName, PeeringServiceInner peeringService, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, peeringServiceName, peeringService), serviceCallback); + } + + /** + * 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 + * @return the observable to the PeeringServiceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String peeringServiceName, PeeringServiceInner peeringService) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, peeringServiceName, peeringService).map(new Func1, PeeringServiceInner>() { + @Override + public PeeringServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the PeeringServiceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String peeringServiceName, PeeringServiceInner peeringService) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringServiceName == null) { + throw new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (peeringService == null) { + throw new IllegalArgumentException("Parameter peeringService is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(peeringService); + return service.createOrUpdate(resourceGroupName, peeringServiceName, this.client.subscriptionId(), peeringService, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String peeringServiceName) { + deleteWithServiceResponseAsync(resourceGroupName, peeringServiceName).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String peeringServiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, peeringServiceName), serviceCallback); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String peeringServiceName) { + return deleteWithServiceResponseAsync(resourceGroupName, peeringServiceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String peeringServiceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringServiceName == null) { + throw new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, peeringServiceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PeeringServiceInner object if successful. + */ + public PeeringServiceInner update(String resourceGroupName, String peeringServiceName) { + return updateWithServiceResponseAsync(resourceGroupName, peeringServiceName).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String peeringServiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, peeringServiceName), serviceCallback); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PeeringServiceInner object + */ + public Observable updateAsync(String resourceGroupName, String peeringServiceName) { + return updateWithServiceResponseAsync(resourceGroupName, peeringServiceName).map(new Func1, PeeringServiceInner>() { + @Override + public PeeringServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PeeringServiceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String peeringServiceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringServiceName == null) { + throw new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Map tags = null; + ResourceTags tags1 = new ResourceTags(); + tags1.withTags(null); + return service.update(resourceGroupName, peeringServiceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), tags1, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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 Gets or sets the tags, a dictionary of descriptors arm object + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PeeringServiceInner object if successful. + */ + public PeeringServiceInner update(String resourceGroupName, String peeringServiceName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, peeringServiceName, tags).toBlocking().single().body(); + } + + /** + * 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 Gets or sets the tags, a dictionary of descriptors arm object + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String peeringServiceName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, peeringServiceName, tags), serviceCallback); + } + + /** + * 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 Gets or sets the tags, a dictionary of descriptors arm object + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PeeringServiceInner object + */ + public Observable updateAsync(String resourceGroupName, String peeringServiceName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, peeringServiceName, tags).map(new Func1, PeeringServiceInner>() { + @Override + public PeeringServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 Gets or sets the tags, a dictionary of descriptors arm object + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PeeringServiceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String peeringServiceName, Map tags) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringServiceName == null) { + throw new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(tags); + ResourceTags tags1 = new ResourceTags(); + tags1.withTags(tags); + return service.update(resourceGroupName, peeringServiceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), tags1, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringServiceInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the peering services under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * 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 + * @return the observable to the PagedList<PeeringServiceInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the PagedList<PeeringServiceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the peering services under the given subscription and resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringServiceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringServiceInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the peerings under the given subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringServiceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringServiceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringServiceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the peering services under the given subscription and resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringServiceInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the peering services under the given subscription and resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the peering services under the given subscription and resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringServiceInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the peering services under the given subscription and resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringServiceInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the peering services under the given subscription and resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringServiceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringServiceInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the peerings under the given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringServiceInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringServiceInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the peerings under the given subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringServiceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringsImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringsImpl.java new file mode 100644 index 0000000000000..f027d56d4f375 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringsImpl.java @@ -0,0 +1,138 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * def + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.peering.v2020_04_01.Peerings; +import com.microsoft.azure.management.peering.v2020_04_01.Peering; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; + +class PeeringsImpl extends GroupableResourcesCoreImpl implements Peerings { + protected PeeringsImpl(PeeringManager manager) { + super(manager.inner().peerings(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + PeeringsInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + PeeringsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + PeeringsInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + PeeringsInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Peering call(PeeringInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + PeeringsInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + PeeringsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Peering call(PeeringInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PeeringImpl define(String name) { + return wrapModel(name); + } + + @Override + protected PeeringImpl wrapModel(PeeringInner inner) { + return new PeeringImpl(inner.name(), inner, manager()); + } + + @Override + protected PeeringImpl wrapModel(String name) { + return new PeeringImpl(name, new PeeringInner(), this.manager()); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringsInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringsInner.java new file mode 100644 index 0000000000000..ed8aa54bcde1c --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PeeringsInner.java @@ -0,0 +1,990 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.peering.v2020_04_01.ErrorResponseException; +import com.microsoft.azure.management.peering.v2020_04_01.ResourceTags; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Peerings. + */ +public class PeeringsInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private PeeringsService service; + /** The service client containing this operation class. */ + private PeeringManagementClientImpl client; + + /** + * Initializes an instance of PeeringsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PeeringsInner(Retrofit retrofit, PeeringManagementClientImpl client) { + this.service = retrofit.create(PeeringsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Peerings to be + * used by Retrofit to perform actually REST calls. + */ + interface PeeringsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.Peerings getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("peeringName") String peeringName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.Peerings createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("peeringName") String peeringName, @Path("subscriptionId") String subscriptionId, @Body PeeringInner peering, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.Peerings delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("peeringName") String peeringName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.Peerings update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("peeringName") String peeringName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ResourceTags tags, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.Peerings listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.Peerings list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerings") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.Peerings listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.Peerings listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PeeringInner object if successful. + */ + public PeeringInner getByResourceGroup(String resourceGroupName, String peeringName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, peeringName).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String peeringName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, peeringName), serviceCallback); + } + + /** + * 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 + * @return the observable to the PeeringInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String peeringName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, peeringName).map(new Func1, PeeringInner>() { + @Override + public PeeringInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the PeeringInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String peeringName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringName == null) { + throw new IllegalArgumentException("Parameter peeringName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(resourceGroupName, peeringName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PeeringInner object if successful. + */ + public PeeringInner createOrUpdate(String resourceGroupName, String peeringName, PeeringInner peering) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, peeringName, peering).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String peeringName, PeeringInner peering, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, peeringName, peering), serviceCallback); + } + + /** + * 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 + * @return the observable to the PeeringInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String peeringName, PeeringInner peering) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, peeringName, peering).map(new Func1, PeeringInner>() { + @Override + public PeeringInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the PeeringInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String peeringName, PeeringInner peering) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringName == null) { + throw new IllegalArgumentException("Parameter peeringName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (peering == null) { + throw new IllegalArgumentException("Parameter peering is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(peering); + return service.createOrUpdate(resourceGroupName, peeringName, this.client.subscriptionId(), peering, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String peeringName) { + deleteWithServiceResponseAsync(resourceGroupName, peeringName).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String peeringName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, peeringName), serviceCallback); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String peeringName) { + return deleteWithServiceResponseAsync(resourceGroupName, peeringName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String peeringName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringName == null) { + throw new IllegalArgumentException("Parameter peeringName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, peeringName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PeeringInner object if successful. + */ + public PeeringInner update(String resourceGroupName, String peeringName) { + return updateWithServiceResponseAsync(resourceGroupName, peeringName).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String peeringName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, peeringName), serviceCallback); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PeeringInner object + */ + public Observable updateAsync(String resourceGroupName, String peeringName) { + return updateWithServiceResponseAsync(resourceGroupName, peeringName).map(new Func1, PeeringInner>() { + @Override + public PeeringInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PeeringInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String peeringName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringName == null) { + throw new IllegalArgumentException("Parameter peeringName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Map tags = null; + ResourceTags tags1 = new ResourceTags(); + tags1.withTags(null); + return service.update(resourceGroupName, peeringName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), tags1, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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 Gets or sets the tags, a dictionary of descriptors arm object + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PeeringInner object if successful. + */ + public PeeringInner update(String resourceGroupName, String peeringName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, peeringName, tags).toBlocking().single().body(); + } + + /** + * 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 Gets or sets the tags, a dictionary of descriptors arm object + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String peeringName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, peeringName, tags), serviceCallback); + } + + /** + * 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 Gets or sets the tags, a dictionary of descriptors arm object + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PeeringInner object + */ + public Observable updateAsync(String resourceGroupName, String peeringName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, peeringName, tags).map(new Func1, PeeringInner>() { + @Override + public PeeringInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 Gets or sets the tags, a dictionary of descriptors arm object + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PeeringInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String peeringName, Map tags) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringName == null) { + throw new IllegalArgumentException("Parameter peeringName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(tags); + ResourceTags tags1 = new ResourceTags(); + tags1.withTags(tags); + return service.update(resourceGroupName, peeringName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), tags1, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the peerings under the given subscription and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * 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 + * @return the observable to the PagedList<PeeringInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the PagedList<PeeringInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the peerings under the given subscription and resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the peerings under the given subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the peerings under the given subscription and resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the peerings under the given subscription and resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the peerings under the given subscription and resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the peerings under the given subscription and resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the peerings under the given subscription and resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the peerings under the given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the peerings under the given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the peerings under the given subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PrefixesImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PrefixesImpl.java new file mode 100644 index 0000000000000..f3b14ab6090fb --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PrefixesImpl.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.peering.v2020_04_01.Prefixes; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringServicePrefix; + +class PrefixesImpl extends WrapperImpl implements Prefixes { + private final PeeringManager manager; + + PrefixesImpl(PeeringManager manager) { + super(manager.inner().prefixes()); + this.manager = manager; + } + + public PeeringManager manager() { + return this.manager; + } + + @Override + public PeeringServicePrefixImpl define(String name) { + return wrapModel(name); + } + + private PeeringServicePrefixImpl wrapModel(PeeringServicePrefixInner inner) { + return new PeeringServicePrefixImpl(inner, manager()); + } + + private PeeringServicePrefixImpl wrapModel(String name) { + return new PeeringServicePrefixImpl(name, this.manager()); + } + + @Override + public Observable listByPeeringServiceAsync(final String resourceGroupName, final String peeringServiceName) { + PrefixesInner client = this.inner(); + return client.listByPeeringServiceAsync(resourceGroupName, peeringServiceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PeeringServicePrefix call(PeeringServicePrefixInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String peeringServiceName, String prefixName) { + PrefixesInner client = this.inner(); + return client.getAsync(resourceGroupName, peeringServiceName, prefixName) + .flatMap(new Func1>() { + @Override + public Observable call(PeeringServicePrefixInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((PeeringServicePrefix)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String peeringServiceName, String prefixName) { + PrefixesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, peeringServiceName, prefixName).toCompletable(); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PrefixesInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PrefixesInner.java new file mode 100644 index 0000000000000..cd649445e320a --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/PrefixesInner.java @@ -0,0 +1,821 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.peering.v2020_04_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Prefixes. + */ +public class PrefixesInner { + /** The Retrofit service to perform REST calls. */ + private PrefixesService service; + /** The service client containing this operation class. */ + private PeeringManagementClientImpl client; + + /** + * Initializes an instance of PrefixesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PrefixesInner(Retrofit retrofit, PeeringManagementClientImpl client) { + this.service = retrofit.create(PrefixesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Prefixes to be + * used by Retrofit to perform actually REST calls. + */ + interface PrefixesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.Prefixes get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes/{prefixName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("peeringServiceName") String peeringServiceName, @Path("prefixName") String prefixName, @Path("subscriptionId") String subscriptionId, @Query("$expand") String expand, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.Prefixes createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes/{prefixName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("peeringServiceName") String peeringServiceName, @Path("prefixName") String prefixName, @Path("subscriptionId") String subscriptionId, @Body PeeringServicePrefixInner peeringServicePrefix, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.Prefixes delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes/{prefixName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("peeringServiceName") String peeringServiceName, @Path("prefixName") String prefixName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.Prefixes listByPeeringService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes") + Observable> listByPeeringService(@Path("resourceGroupName") String resourceGroupName, @Path("peeringServiceName") String peeringServiceName, @Path("subscriptionId") String subscriptionId, @Query("$expand") String expand, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.Prefixes listByPeeringServiceNext" }) + @GET + Observable> listByPeeringServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PeeringServicePrefixInner object if successful. + */ + public PeeringServicePrefixInner get(String resourceGroupName, String peeringServiceName, String prefixName) { + return getWithServiceResponseAsync(resourceGroupName, peeringServiceName, prefixName).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String peeringServiceName, String prefixName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, peeringServiceName, prefixName), serviceCallback); + } + + /** + * 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 + * @return the observable to the PeeringServicePrefixInner object + */ + public Observable getAsync(String resourceGroupName, String peeringServiceName, String prefixName) { + return getWithServiceResponseAsync(resourceGroupName, peeringServiceName, prefixName).map(new Func1, PeeringServicePrefixInner>() { + @Override + public PeeringServicePrefixInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the PeeringServicePrefixInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String peeringServiceName, String prefixName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringServiceName == null) { + throw new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null."); + } + if (prefixName == null) { + throw new IllegalArgumentException("Parameter prefixName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String expand = null; + return service.get(resourceGroupName, peeringServiceName, prefixName, this.client.subscriptionId(), expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PeeringServicePrefixInner object if successful. + */ + public PeeringServicePrefixInner get(String resourceGroupName, String peeringServiceName, String prefixName, String expand) { + return getWithServiceResponseAsync(resourceGroupName, peeringServiceName, prefixName, expand).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String peeringServiceName, String prefixName, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, peeringServiceName, prefixName, expand), serviceCallback); + } + + /** + * 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 + * @return the observable to the PeeringServicePrefixInner object + */ + public Observable getAsync(String resourceGroupName, String peeringServiceName, String prefixName, String expand) { + return getWithServiceResponseAsync(resourceGroupName, peeringServiceName, prefixName, expand).map(new Func1, PeeringServicePrefixInner>() { + @Override + public PeeringServicePrefixInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the PeeringServicePrefixInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String peeringServiceName, String prefixName, String expand) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringServiceName == null) { + throw new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null."); + } + if (prefixName == null) { + throw new IllegalArgumentException("Parameter prefixName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, peeringServiceName, prefixName, this.client.subscriptionId(), expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PeeringServicePrefixInner object if successful. + */ + public PeeringServicePrefixInner createOrUpdate(String resourceGroupName, String peeringServiceName, String prefixName, PeeringServicePrefixInner peeringServicePrefix) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, peeringServiceName, prefixName, peeringServicePrefix).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String peeringServiceName, String prefixName, PeeringServicePrefixInner peeringServicePrefix, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, peeringServiceName, prefixName, peeringServicePrefix), serviceCallback); + } + + /** + * 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 + * @return the observable to the PeeringServicePrefixInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String peeringServiceName, String prefixName, PeeringServicePrefixInner peeringServicePrefix) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, peeringServiceName, prefixName, peeringServicePrefix).map(new Func1, PeeringServicePrefixInner>() { + @Override + public PeeringServicePrefixInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the PeeringServicePrefixInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String peeringServiceName, String prefixName, PeeringServicePrefixInner peeringServicePrefix) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringServiceName == null) { + throw new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null."); + } + if (prefixName == null) { + throw new IllegalArgumentException("Parameter prefixName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (peeringServicePrefix == null) { + throw new IllegalArgumentException("Parameter peeringServicePrefix is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(peeringServicePrefix); + return service.createOrUpdate(resourceGroupName, peeringServiceName, prefixName, this.client.subscriptionId(), peeringServicePrefix, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String peeringServiceName, String prefixName) { + deleteWithServiceResponseAsync(resourceGroupName, peeringServiceName, prefixName).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String peeringServiceName, String prefixName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, peeringServiceName, prefixName), serviceCallback); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String peeringServiceName, String prefixName) { + return deleteWithServiceResponseAsync(resourceGroupName, peeringServiceName, prefixName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String peeringServiceName, String prefixName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringServiceName == null) { + throw new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null."); + } + if (prefixName == null) { + throw new IllegalArgumentException("Parameter prefixName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, peeringServiceName, prefixName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringServicePrefixInner> object if successful. + */ + public PagedList listByPeeringService(final String resourceGroupName, final String peeringServiceName) { + ServiceResponse> response = listByPeeringServiceSinglePageAsync(resourceGroupName, peeringServiceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByPeeringServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByPeeringServiceAsync(final String resourceGroupName, final String peeringServiceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByPeeringServiceSinglePageAsync(resourceGroupName, peeringServiceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByPeeringServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * 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 + * @return the observable to the PagedList<PeeringServicePrefixInner> object + */ + public Observable> listByPeeringServiceAsync(final String resourceGroupName, final String peeringServiceName) { + return listByPeeringServiceWithServiceResponseAsync(resourceGroupName, peeringServiceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the PagedList<PeeringServicePrefixInner> object + */ + public Observable>> listByPeeringServiceWithServiceResponseAsync(final String resourceGroupName, final String peeringServiceName) { + return listByPeeringServiceSinglePageAsync(resourceGroupName, peeringServiceName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByPeeringServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * 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 + * @return the PagedList<PeeringServicePrefixInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByPeeringServiceSinglePageAsync(final String resourceGroupName, final String peeringServiceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringServiceName == null) { + throw new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String expand = null; + return service.listByPeeringService(resourceGroupName, peeringServiceName, this.client.subscriptionId(), expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByPeeringServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringServicePrefixInner> object if successful. + */ + public PagedList listByPeeringService(final String resourceGroupName, final String peeringServiceName, final String expand) { + ServiceResponse> response = listByPeeringServiceSinglePageAsync(resourceGroupName, peeringServiceName, expand).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByPeeringServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByPeeringServiceAsync(final String resourceGroupName, final String peeringServiceName, final String expand, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByPeeringServiceSinglePageAsync(resourceGroupName, peeringServiceName, expand), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByPeeringServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * 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 + * @return the observable to the PagedList<PeeringServicePrefixInner> object + */ + public Observable> listByPeeringServiceAsync(final String resourceGroupName, final String peeringServiceName, final String expand) { + return listByPeeringServiceWithServiceResponseAsync(resourceGroupName, peeringServiceName, expand) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the PagedList<PeeringServicePrefixInner> object + */ + public Observable>> listByPeeringServiceWithServiceResponseAsync(final String resourceGroupName, final String peeringServiceName, final String expand) { + return listByPeeringServiceSinglePageAsync(resourceGroupName, peeringServiceName, expand) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByPeeringServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all prefixes under the given subscription, resource group and peering service. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param peeringServiceName The name of the peering service. + ServiceResponse> * @param expand The properties to be expanded. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringServicePrefixInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByPeeringServiceSinglePageAsync(final String resourceGroupName, final String peeringServiceName, final String expand) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringServiceName == null) { + throw new IllegalArgumentException("Parameter peeringServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByPeeringService(resourceGroupName, peeringServiceName, this.client.subscriptionId(), expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByPeeringServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByPeeringServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all prefixes under the given subscription, resource group and peering service. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringServicePrefixInner> object if successful. + */ + public PagedList listByPeeringServiceNext(final String nextPageLink) { + ServiceResponse> response = listByPeeringServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByPeeringServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all prefixes under the given subscription, resource group and peering service. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByPeeringServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByPeeringServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByPeeringServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all prefixes under the given subscription, resource group and peering service. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringServicePrefixInner> object + */ + public Observable> listByPeeringServiceNextAsync(final String nextPageLink) { + return listByPeeringServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all prefixes under the given subscription, resource group and peering service. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringServicePrefixInner> object + */ + public Observable>> listByPeeringServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByPeeringServiceNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByPeeringServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all prefixes under the given subscription, resource group and peering service. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringServicePrefixInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByPeeringServiceNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByPeeringServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByPeeringServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByPeeringServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/ReceivedRoutesImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/ReceivedRoutesImpl.java new file mode 100644 index 0000000000000..8d71832b3c3d8 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/ReceivedRoutesImpl.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.peering.v2020_04_01.ReceivedRoutes; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringReceivedRoute; + +class ReceivedRoutesImpl extends WrapperImpl implements ReceivedRoutes { + private final PeeringManager manager; + + ReceivedRoutesImpl(PeeringManager manager) { + super(manager.inner().receivedRoutes()); + this.manager = manager; + } + + public PeeringManager manager() { + return this.manager; + } + + private PeeringReceivedRouteImpl wrapModel(PeeringReceivedRouteInner inner) { + return new PeeringReceivedRouteImpl(inner, manager()); + } + + @Override + public Observable listByPeeringAsync(final String resourceGroupName, final String peeringName) { + ReceivedRoutesInner client = this.inner(); + return client.listByPeeringAsync(resourceGroupName, peeringName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PeeringReceivedRoute call(PeeringReceivedRouteInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/ReceivedRoutesInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/ReceivedRoutesInner.java new file mode 100644 index 0000000000000..6dd6ba0da753f --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/ReceivedRoutesInner.java @@ -0,0 +1,449 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.peering.v2020_04_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ReceivedRoutes. + */ +public class ReceivedRoutesInner { + /** The Retrofit service to perform REST calls. */ + private ReceivedRoutesService service; + /** The service client containing this operation class. */ + private PeeringManagementClientImpl client; + + /** + * Initializes an instance of ReceivedRoutesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReceivedRoutesInner(Retrofit retrofit, PeeringManagementClientImpl client) { + this.service = retrofit.create(ReceivedRoutesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReceivedRoutes to be + * used by Retrofit to perform actually REST calls. + */ + interface ReceivedRoutesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.ReceivedRoutes listByPeering" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/receivedRoutes") + Observable> listByPeering(@Path("resourceGroupName") String resourceGroupName, @Path("peeringName") String peeringName, @Path("subscriptionId") String subscriptionId, @Query("prefix") String prefix, @Query("asPath") String asPath, @Query("originAsValidationState") String originAsValidationState, @Query("rpkiValidationState") String rpkiValidationState, @Query("$skipToken") String skipToken, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.ReceivedRoutes listByPeeringNext" }) + @GET + Observable> listByPeeringNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringReceivedRouteInner> object if successful. + */ + public PagedList listByPeering(final String resourceGroupName, final String peeringName) { + ServiceResponse> response = listByPeeringSinglePageAsync(resourceGroupName, peeringName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByPeeringNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByPeeringAsync(final String resourceGroupName, final String peeringName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByPeeringSinglePageAsync(resourceGroupName, peeringName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByPeeringNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * 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 + * @return the observable to the PagedList<PeeringReceivedRouteInner> object + */ + public Observable> listByPeeringAsync(final String resourceGroupName, final String peeringName) { + return listByPeeringWithServiceResponseAsync(resourceGroupName, peeringName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the PagedList<PeeringReceivedRouteInner> object + */ + public Observable>> listByPeeringWithServiceResponseAsync(final String resourceGroupName, final String peeringName) { + return listByPeeringSinglePageAsync(resourceGroupName, peeringName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByPeeringNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * 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 + * @return the PagedList<PeeringReceivedRouteInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByPeeringSinglePageAsync(final String resourceGroupName, final String peeringName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringName == null) { + throw new IllegalArgumentException("Parameter peeringName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String prefix = null; + final String asPath = null; + final String originAsValidationState = null; + final String rpkiValidationState = null; + final String skipToken = null; + return service.listByPeering(resourceGroupName, peeringName, this.client.subscriptionId(), prefix, asPath, originAsValidationState, rpkiValidationState, skipToken, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByPeeringDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringReceivedRouteInner> object if successful. + */ + public PagedList listByPeering(final String resourceGroupName, final String peeringName, final String prefix, final String asPath, final String originAsValidationState, final String rpkiValidationState, final String skipToken) { + ServiceResponse> response = listByPeeringSinglePageAsync(resourceGroupName, peeringName, prefix, asPath, originAsValidationState, rpkiValidationState, skipToken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByPeeringNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByPeeringAsync(final String resourceGroupName, final String peeringName, final String prefix, final String asPath, final String originAsValidationState, final String rpkiValidationState, final String skipToken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByPeeringSinglePageAsync(resourceGroupName, peeringName, prefix, asPath, originAsValidationState, rpkiValidationState, skipToken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByPeeringNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * 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 + * @return the observable to the PagedList<PeeringReceivedRouteInner> object + */ + public Observable> listByPeeringAsync(final String resourceGroupName, final String peeringName, final String prefix, final String asPath, final String originAsValidationState, final String rpkiValidationState, final String skipToken) { + return listByPeeringWithServiceResponseAsync(resourceGroupName, peeringName, prefix, asPath, originAsValidationState, rpkiValidationState, skipToken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the PagedList<PeeringReceivedRouteInner> object + */ + public Observable>> listByPeeringWithServiceResponseAsync(final String resourceGroupName, final String peeringName, final String prefix, final String asPath, final String originAsValidationState, final String rpkiValidationState, final String skipToken) { + return listByPeeringSinglePageAsync(resourceGroupName, peeringName, prefix, asPath, originAsValidationState, rpkiValidationState, skipToken) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByPeeringNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the prefixes received over the specified peering under the given subscription and resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param peeringName The name of the peering. + ServiceResponse> * @param prefix The optional prefix that can be used to filter the routes. + ServiceResponse> * @param asPath The optional AS path that can be used to filter the routes. + ServiceResponse> * @param originAsValidationState The optional origin AS validation state that can be used to filter the routes. + ServiceResponse> * @param rpkiValidationState The optional RPKI validation state that can be used to filter the routes. + ServiceResponse> * @param skipToken The optional page continuation token that is used in the event of paginated result. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringReceivedRouteInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByPeeringSinglePageAsync(final String resourceGroupName, final String peeringName, final String prefix, final String asPath, final String originAsValidationState, final String rpkiValidationState, final String skipToken) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringName == null) { + throw new IllegalArgumentException("Parameter peeringName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByPeering(resourceGroupName, peeringName, this.client.subscriptionId(), prefix, asPath, originAsValidationState, rpkiValidationState, skipToken, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByPeeringDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByPeeringDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the prefixes received over the specified peering under the given subscription and resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringReceivedRouteInner> object if successful. + */ + public PagedList listByPeeringNext(final String nextPageLink) { + ServiceResponse> response = listByPeeringNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByPeeringNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the prefixes received over the specified peering under the given subscription and resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByPeeringNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByPeeringNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByPeeringNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the prefixes received over the specified peering under the given subscription and resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringReceivedRouteInner> object + */ + public Observable> listByPeeringNextAsync(final String nextPageLink) { + return listByPeeringNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the prefixes received over the specified peering under the given subscription and resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringReceivedRouteInner> object + */ + public Observable>> listByPeeringNextWithServiceResponseAsync(final String nextPageLink) { + return listByPeeringNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByPeeringNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the prefixes received over the specified peering under the given subscription and resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringReceivedRouteInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByPeeringNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByPeeringNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByPeeringNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByPeeringNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/RegisteredAsnsImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/RegisteredAsnsImpl.java new file mode 100644 index 0000000000000..abae0bad83d82 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/RegisteredAsnsImpl.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.peering.v2020_04_01.RegisteredAsns; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringRegisteredAsn; + +class RegisteredAsnsImpl extends WrapperImpl implements RegisteredAsns { + private final PeeringManager manager; + + RegisteredAsnsImpl(PeeringManager manager) { + super(manager.inner().registeredAsns()); + this.manager = manager; + } + + public PeeringManager manager() { + return this.manager; + } + + @Override + public PeeringRegisteredAsnImpl define(String name) { + return wrapModel(name); + } + + private PeeringRegisteredAsnImpl wrapModel(PeeringRegisteredAsnInner inner) { + return new PeeringRegisteredAsnImpl(inner, manager()); + } + + private PeeringRegisteredAsnImpl wrapModel(String name) { + return new PeeringRegisteredAsnImpl(name, this.manager()); + } + + @Override + public Observable listByPeeringAsync(final String resourceGroupName, final String peeringName) { + RegisteredAsnsInner client = this.inner(); + return client.listByPeeringAsync(resourceGroupName, peeringName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PeeringRegisteredAsn call(PeeringRegisteredAsnInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String peeringName, String registeredAsnName) { + RegisteredAsnsInner client = this.inner(); + return client.getAsync(resourceGroupName, peeringName, registeredAsnName) + .flatMap(new Func1>() { + @Override + public Observable call(PeeringRegisteredAsnInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((PeeringRegisteredAsn)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String peeringName, String registeredAsnName) { + RegisteredAsnsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, peeringName, registeredAsnName).toCompletable(); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/RegisteredAsnsInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/RegisteredAsnsInner.java new file mode 100644 index 0000000000000..98081c9886aea --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/RegisteredAsnsInner.java @@ -0,0 +1,694 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.peering.v2020_04_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in RegisteredAsns. + */ +public class RegisteredAsnsInner { + /** The Retrofit service to perform REST calls. */ + private RegisteredAsnsService service; + /** The service client containing this operation class. */ + private PeeringManagementClientImpl client; + + /** + * Initializes an instance of RegisteredAsnsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RegisteredAsnsInner(Retrofit retrofit, PeeringManagementClientImpl client) { + this.service = retrofit.create(RegisteredAsnsService.class); + this.client = client; + } + + /** + * The interface defining all the services for RegisteredAsns to be + * used by Retrofit to perform actually REST calls. + */ + interface RegisteredAsnsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.RegisteredAsns get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredAsns/{registeredAsnName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("peeringName") String peeringName, @Path("registeredAsnName") String registeredAsnName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.RegisteredAsns createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredAsns/{registeredAsnName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("peeringName") String peeringName, @Path("registeredAsnName") String registeredAsnName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body PeeringRegisteredAsnInner registeredAsn, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.RegisteredAsns delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredAsns/{registeredAsnName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("peeringName") String peeringName, @Path("registeredAsnName") String registeredAsnName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.RegisteredAsns listByPeering" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredAsns") + Observable> listByPeering(@Path("resourceGroupName") String resourceGroupName, @Path("peeringName") String peeringName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.RegisteredAsns listByPeeringNext" }) + @GET + Observable> listByPeeringNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PeeringRegisteredAsnInner object if successful. + */ + public PeeringRegisteredAsnInner get(String resourceGroupName, String peeringName, String registeredAsnName) { + return getWithServiceResponseAsync(resourceGroupName, peeringName, registeredAsnName).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String peeringName, String registeredAsnName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, peeringName, registeredAsnName), serviceCallback); + } + + /** + * 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 + * @return the observable to the PeeringRegisteredAsnInner object + */ + public Observable getAsync(String resourceGroupName, String peeringName, String registeredAsnName) { + return getWithServiceResponseAsync(resourceGroupName, peeringName, registeredAsnName).map(new Func1, PeeringRegisteredAsnInner>() { + @Override + public PeeringRegisteredAsnInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the PeeringRegisteredAsnInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String peeringName, String registeredAsnName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringName == null) { + throw new IllegalArgumentException("Parameter peeringName is required and cannot be null."); + } + if (registeredAsnName == null) { + throw new IllegalArgumentException("Parameter registeredAsnName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, peeringName, registeredAsnName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PeeringRegisteredAsnInner object if successful. + */ + public PeeringRegisteredAsnInner createOrUpdate(String resourceGroupName, String peeringName, String registeredAsnName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, peeringName, registeredAsnName).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String peeringName, String registeredAsnName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, peeringName, registeredAsnName), serviceCallback); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PeeringRegisteredAsnInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String peeringName, String registeredAsnName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, peeringName, registeredAsnName).map(new Func1, PeeringRegisteredAsnInner>() { + @Override + public PeeringRegisteredAsnInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PeeringRegisteredAsnInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String peeringName, String registeredAsnName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringName == null) { + throw new IllegalArgumentException("Parameter peeringName is required and cannot be null."); + } + if (registeredAsnName == null) { + throw new IllegalArgumentException("Parameter registeredAsnName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Integer asn = null; + PeeringRegisteredAsnInner registeredAsn = new PeeringRegisteredAsnInner(); + registeredAsn.withAsn(null); + return service.createOrUpdate(resourceGroupName, peeringName, registeredAsnName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), registeredAsn, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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 asn The customer's ASN from which traffic originates. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PeeringRegisteredAsnInner object if successful. + */ + public PeeringRegisteredAsnInner createOrUpdate(String resourceGroupName, String peeringName, String registeredAsnName, Integer asn) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, peeringName, registeredAsnName, asn).toBlocking().single().body(); + } + + /** + * 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 asn The customer's ASN from which traffic originates. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String peeringName, String registeredAsnName, Integer asn, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, peeringName, registeredAsnName, asn), serviceCallback); + } + + /** + * 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 asn The customer's ASN from which traffic originates. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PeeringRegisteredAsnInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String peeringName, String registeredAsnName, Integer asn) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, peeringName, registeredAsnName, asn).map(new Func1, PeeringRegisteredAsnInner>() { + @Override + public PeeringRegisteredAsnInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 asn The customer's ASN from which traffic originates. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PeeringRegisteredAsnInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String peeringName, String registeredAsnName, Integer asn) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringName == null) { + throw new IllegalArgumentException("Parameter peeringName is required and cannot be null."); + } + if (registeredAsnName == null) { + throw new IllegalArgumentException("Parameter registeredAsnName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + PeeringRegisteredAsnInner registeredAsn = new PeeringRegisteredAsnInner(); + registeredAsn.withAsn(asn); + return service.createOrUpdate(resourceGroupName, peeringName, registeredAsnName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), registeredAsn, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String peeringName, String registeredAsnName) { + deleteWithServiceResponseAsync(resourceGroupName, peeringName, registeredAsnName).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String peeringName, String registeredAsnName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, peeringName, registeredAsnName), serviceCallback); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String peeringName, String registeredAsnName) { + return deleteWithServiceResponseAsync(resourceGroupName, peeringName, registeredAsnName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String peeringName, String registeredAsnName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringName == null) { + throw new IllegalArgumentException("Parameter peeringName is required and cannot be null."); + } + if (registeredAsnName == null) { + throw new IllegalArgumentException("Parameter registeredAsnName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, peeringName, registeredAsnName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringRegisteredAsnInner> object if successful. + */ + public PagedList listByPeering(final String resourceGroupName, final String peeringName) { + ServiceResponse> response = listByPeeringSinglePageAsync(resourceGroupName, peeringName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByPeeringNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByPeeringAsync(final String resourceGroupName, final String peeringName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByPeeringSinglePageAsync(resourceGroupName, peeringName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByPeeringNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * 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 + * @return the observable to the PagedList<PeeringRegisteredAsnInner> object + */ + public Observable> listByPeeringAsync(final String resourceGroupName, final String peeringName) { + return listByPeeringWithServiceResponseAsync(resourceGroupName, peeringName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the PagedList<PeeringRegisteredAsnInner> object + */ + public Observable>> listByPeeringWithServiceResponseAsync(final String resourceGroupName, final String peeringName) { + return listByPeeringSinglePageAsync(resourceGroupName, peeringName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByPeeringNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all registered ASNs under the given subscription, resource group and peering. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param peeringName The name of the peering. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringRegisteredAsnInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByPeeringSinglePageAsync(final String resourceGroupName, final String peeringName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringName == null) { + throw new IllegalArgumentException("Parameter peeringName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByPeering(resourceGroupName, peeringName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByPeeringDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByPeeringDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all registered ASNs under the given subscription, resource group and peering. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringRegisteredAsnInner> object if successful. + */ + public PagedList listByPeeringNext(final String nextPageLink) { + ServiceResponse> response = listByPeeringNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByPeeringNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all registered ASNs under the given subscription, resource group and peering. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByPeeringNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByPeeringNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByPeeringNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all registered ASNs under the given subscription, resource group and peering. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringRegisteredAsnInner> object + */ + public Observable> listByPeeringNextAsync(final String nextPageLink) { + return listByPeeringNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all registered ASNs under the given subscription, resource group and peering. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringRegisteredAsnInner> object + */ + public Observable>> listByPeeringNextWithServiceResponseAsync(final String nextPageLink) { + return listByPeeringNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByPeeringNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all registered ASNs under the given subscription, resource group and peering. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringRegisteredAsnInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByPeeringNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByPeeringNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByPeeringNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByPeeringNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/RegisteredPrefixesImpl.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/RegisteredPrefixesImpl.java new file mode 100644 index 0000000000000..4afc751c691c0 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/RegisteredPrefixesImpl.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.peering.v2020_04_01.RegisteredPrefixes; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.peering.v2020_04_01.PeeringRegisteredPrefix; + +class RegisteredPrefixesImpl extends WrapperImpl implements RegisteredPrefixes { + private final PeeringManager manager; + + RegisteredPrefixesImpl(PeeringManager manager) { + super(manager.inner().registeredPrefixes()); + this.manager = manager; + } + + public PeeringManager manager() { + return this.manager; + } + + @Override + public PeeringRegisteredPrefixImpl define(String name) { + return wrapModel(name); + } + + private PeeringRegisteredPrefixImpl wrapModel(PeeringRegisteredPrefixInner inner) { + return new PeeringRegisteredPrefixImpl(inner, manager()); + } + + private PeeringRegisteredPrefixImpl wrapModel(String name) { + return new PeeringRegisteredPrefixImpl(name, this.manager()); + } + + @Override + public Observable listByPeeringAsync(final String resourceGroupName, final String peeringName) { + RegisteredPrefixesInner client = this.inner(); + return client.listByPeeringAsync(resourceGroupName, peeringName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PeeringRegisteredPrefix call(PeeringRegisteredPrefixInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String peeringName, String registeredPrefixName) { + RegisteredPrefixesInner client = this.inner(); + return client.getAsync(resourceGroupName, peeringName, registeredPrefixName) + .flatMap(new Func1>() { + @Override + public Observable call(PeeringRegisteredPrefixInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((PeeringRegisteredPrefix)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String peeringName, String registeredPrefixName) { + RegisteredPrefixesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, peeringName, registeredPrefixName).toCompletable(); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/RegisteredPrefixesInner.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/RegisteredPrefixesInner.java new file mode 100644 index 0000000000000..ce5cd153efdd9 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/RegisteredPrefixesInner.java @@ -0,0 +1,694 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.peering.v2020_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.peering.v2020_04_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in RegisteredPrefixes. + */ +public class RegisteredPrefixesInner { + /** The Retrofit service to perform REST calls. */ + private RegisteredPrefixesService service; + /** The service client containing this operation class. */ + private PeeringManagementClientImpl client; + + /** + * Initializes an instance of RegisteredPrefixesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RegisteredPrefixesInner(Retrofit retrofit, PeeringManagementClientImpl client) { + this.service = retrofit.create(RegisteredPrefixesService.class); + this.client = client; + } + + /** + * The interface defining all the services for RegisteredPrefixes to be + * used by Retrofit to perform actually REST calls. + */ + interface RegisteredPrefixesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.RegisteredPrefixes get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes/{registeredPrefixName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("peeringName") String peeringName, @Path("registeredPrefixName") String registeredPrefixName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.RegisteredPrefixes createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes/{registeredPrefixName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("peeringName") String peeringName, @Path("registeredPrefixName") String registeredPrefixName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body PeeringRegisteredPrefixInner registeredPrefix, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.RegisteredPrefixes delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes/{registeredPrefixName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("peeringName") String peeringName, @Path("registeredPrefixName") String registeredPrefixName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.RegisteredPrefixes listByPeering" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes") + Observable> listByPeering(@Path("resourceGroupName") String resourceGroupName, @Path("peeringName") String peeringName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.peering.v2020_04_01.RegisteredPrefixes listByPeeringNext" }) + @GET + Observable> listByPeeringNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PeeringRegisteredPrefixInner object if successful. + */ + public PeeringRegisteredPrefixInner get(String resourceGroupName, String peeringName, String registeredPrefixName) { + return getWithServiceResponseAsync(resourceGroupName, peeringName, registeredPrefixName).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String peeringName, String registeredPrefixName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, peeringName, registeredPrefixName), serviceCallback); + } + + /** + * 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 + * @return the observable to the PeeringRegisteredPrefixInner object + */ + public Observable getAsync(String resourceGroupName, String peeringName, String registeredPrefixName) { + return getWithServiceResponseAsync(resourceGroupName, peeringName, registeredPrefixName).map(new Func1, PeeringRegisteredPrefixInner>() { + @Override + public PeeringRegisteredPrefixInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the PeeringRegisteredPrefixInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String peeringName, String registeredPrefixName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringName == null) { + throw new IllegalArgumentException("Parameter peeringName is required and cannot be null."); + } + if (registeredPrefixName == null) { + throw new IllegalArgumentException("Parameter registeredPrefixName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, peeringName, registeredPrefixName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PeeringRegisteredPrefixInner object if successful. + */ + public PeeringRegisteredPrefixInner createOrUpdate(String resourceGroupName, String peeringName, String registeredPrefixName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, peeringName, registeredPrefixName).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String peeringName, String registeredPrefixName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, peeringName, registeredPrefixName), serviceCallback); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PeeringRegisteredPrefixInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String peeringName, String registeredPrefixName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, peeringName, registeredPrefixName).map(new Func1, PeeringRegisteredPrefixInner>() { + @Override + public PeeringRegisteredPrefixInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PeeringRegisteredPrefixInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String peeringName, String registeredPrefixName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringName == null) { + throw new IllegalArgumentException("Parameter peeringName is required and cannot be null."); + } + if (registeredPrefixName == null) { + throw new IllegalArgumentException("Parameter registeredPrefixName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String prefix = null; + PeeringRegisteredPrefixInner registeredPrefix = new PeeringRegisteredPrefixInner(); + registeredPrefix.withPrefix(null); + return service.createOrUpdate(resourceGroupName, peeringName, registeredPrefixName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), registeredPrefix, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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 prefix The customer's prefix from which traffic originates. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PeeringRegisteredPrefixInner object if successful. + */ + public PeeringRegisteredPrefixInner createOrUpdate(String resourceGroupName, String peeringName, String registeredPrefixName, String prefix) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, peeringName, registeredPrefixName, prefix).toBlocking().single().body(); + } + + /** + * 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 prefix The customer's prefix from which traffic originates. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String peeringName, String registeredPrefixName, String prefix, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, peeringName, registeredPrefixName, prefix), serviceCallback); + } + + /** + * 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 prefix The customer's prefix from which traffic originates. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PeeringRegisteredPrefixInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String peeringName, String registeredPrefixName, String prefix) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, peeringName, registeredPrefixName, prefix).map(new Func1, PeeringRegisteredPrefixInner>() { + @Override + public PeeringRegisteredPrefixInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 prefix The customer's prefix from which traffic originates. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PeeringRegisteredPrefixInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String peeringName, String registeredPrefixName, String prefix) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringName == null) { + throw new IllegalArgumentException("Parameter peeringName is required and cannot be null."); + } + if (registeredPrefixName == null) { + throw new IllegalArgumentException("Parameter registeredPrefixName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + PeeringRegisteredPrefixInner registeredPrefix = new PeeringRegisteredPrefixInner(); + registeredPrefix.withPrefix(prefix); + return service.createOrUpdate(resourceGroupName, peeringName, registeredPrefixName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), registeredPrefix, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String peeringName, String registeredPrefixName) { + deleteWithServiceResponseAsync(resourceGroupName, peeringName, registeredPrefixName).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String peeringName, String registeredPrefixName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, peeringName, registeredPrefixName), serviceCallback); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String peeringName, String registeredPrefixName) { + return deleteWithServiceResponseAsync(resourceGroupName, peeringName, registeredPrefixName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String peeringName, String registeredPrefixName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringName == null) { + throw new IllegalArgumentException("Parameter peeringName is required and cannot be null."); + } + if (registeredPrefixName == null) { + throw new IllegalArgumentException("Parameter registeredPrefixName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, peeringName, registeredPrefixName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringRegisteredPrefixInner> object if successful. + */ + public PagedList listByPeering(final String resourceGroupName, final String peeringName) { + ServiceResponse> response = listByPeeringSinglePageAsync(resourceGroupName, peeringName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByPeeringNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByPeeringAsync(final String resourceGroupName, final String peeringName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByPeeringSinglePageAsync(resourceGroupName, peeringName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByPeeringNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * 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 + * @return the observable to the PagedList<PeeringRegisteredPrefixInner> object + */ + public Observable> listByPeeringAsync(final String resourceGroupName, final String peeringName) { + return listByPeeringWithServiceResponseAsync(resourceGroupName, peeringName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the PagedList<PeeringRegisteredPrefixInner> object + */ + public Observable>> listByPeeringWithServiceResponseAsync(final String resourceGroupName, final String peeringName) { + return listByPeeringSinglePageAsync(resourceGroupName, peeringName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByPeeringNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all registered prefixes under the given subscription, resource group and peering. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param peeringName The name of the peering. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringRegisteredPrefixInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByPeeringSinglePageAsync(final String resourceGroupName, final String peeringName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (peeringName == null) { + throw new IllegalArgumentException("Parameter peeringName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByPeering(resourceGroupName, peeringName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByPeeringDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByPeeringDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all registered prefixes under the given subscription, resource group and peering. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PeeringRegisteredPrefixInner> object if successful. + */ + public PagedList listByPeeringNext(final String nextPageLink) { + ServiceResponse> response = listByPeeringNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByPeeringNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all registered prefixes under the given subscription, resource group and peering. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByPeeringNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByPeeringNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByPeeringNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all registered prefixes under the given subscription, resource group and peering. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringRegisteredPrefixInner> object + */ + public Observable> listByPeeringNextAsync(final String nextPageLink) { + return listByPeeringNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all registered prefixes under the given subscription, resource group and peering. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PeeringRegisteredPrefixInner> object + */ + public Observable>> listByPeeringNextWithServiceResponseAsync(final String nextPageLink) { + return listByPeeringNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByPeeringNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all registered prefixes under the given subscription, resource group and peering. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PeeringRegisteredPrefixInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByPeeringNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByPeeringNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByPeeringNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByPeeringNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/package-info.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/package-info.java new file mode 100644 index 0000000000000..fe554ae67a58b --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for PeeringManagementClient. + * Peering Client. + */ +package com.microsoft.azure.management.peering.v2020_04_01.implementation; diff --git a/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/package-info.java b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/package-info.java new file mode 100644 index 0000000000000..2bf7b8f1a5d39 --- /dev/null +++ b/sdk/peering/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/peering/v2020_04_01/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for PeeringManagementClient. + * Peering Client. + */ +package com.microsoft.azure.management.peering.v2020_04_01;