diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 954c8058af96..2b6778ff23a5 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -13,7 +13,7 @@ /sdk/core/ @alzimmermsft @jianghaolu @srnagar @hemanttanwar /sdk/cosmos/ @moderakh @christopheranderson @kushagraThapar /sdk/eventhubs/ @conniey @srnagar @mssfang -/sdk/identity/ @jianghaolu @g2vinay +/sdk/identity/ @jianghaolu @g2vinay @hemanttanwar /sdk/keyvault/ @g2vinay @samvaity /sdk/servicebus/ @yvgopal @nemakam /sdk/tracing/ @samvaity @alzimmermsft diff --git a/containerregistry/resource-manager/v2019_04_01/pom.xml b/containerregistry/resource-manager/v2019_04_01/pom.xml index 5032fd3bb242..6d8c4059d2be 100644 --- a/containerregistry/resource-manager/v2019_04_01/pom.xml +++ b/containerregistry/resource-manager/v2019_04_01/pom.xml @@ -11,11 +11,11 @@ com.microsoft.azure azure-arm-parent - 1.1.0 - ../../../pom.management.xml + 0.0.3-beta + ../../../pom.xml azure-mgmt-containerregistry - 1.0.0-beta-1 + 1.0.0-beta jar Microsoft Azure SDK for ContainerRegistry Management This package contains Microsoft ContainerRegistry Management SDK. diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Action.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Action.java new file mode 100644 index 000000000000..ca1d0fff2f0e --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Action.java @@ -0,0 +1,38 @@ +/** + * 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.containerregistry.v2019_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Action. + */ +public final class Action extends ExpandableStringEnum { + /** Static value Allow for Action. */ + public static final Action ALLOW = fromString("Allow"); + + /** + * Creates or finds a Action from its string representation. + * @param name a name to look for + * @return the corresponding Action + */ + @JsonCreator + public static Action fromString(String name) { + return fromString(name, Action.class); + } + + /** + * @return known Action values + */ + public static Collection values() { + return values(Action.class); + } +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Actor.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Actor.java new file mode 100644 index 000000000000..7ac0ea6dfca7 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Actor.java @@ -0,0 +1,45 @@ +/** + * 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.containerregistry.v2019_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The agent that initiated the event. For most situations, this could be from + * the authorization context of the request. + */ +public class Actor { + /** + * The subject or username associated with the request context that + * generated the event. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get the subject or username associated with the request context that generated the event. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the subject or username associated with the request context that generated the event. + * + * @param name the name value to set + * @return the Actor object itself. + */ + public Actor withName(String name) { + this.name = name; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/CallbackConfig.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/CallbackConfig.java new file mode 100644 index 000000000000..3c10aea5a69a --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/CallbackConfig.java @@ -0,0 +1,31 @@ +/** + * 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.containerregistry.v2019_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.containerregistry.v2019_04_01.implementation.ContainerRegistryManager; +import com.microsoft.azure.management.containerregistry.v2019_04_01.implementation.CallbackConfigInner; +import java.util.Map; + +/** + * Type representing CallbackConfig. + */ +public interface CallbackConfig extends HasInner, HasManager { + /** + * @return the customHeaders value. + */ + Map customHeaders(); + + /** + * @return the serviceUri value. + */ + String serviceUri(); + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/DefaultAction.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/DefaultAction.java new file mode 100644 index 000000000000..1272dc91ef02 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/DefaultAction.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.containerregistry.v2019_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DefaultAction. + */ +public final class DefaultAction extends ExpandableStringEnum { + /** Static value Allow for DefaultAction. */ + public static final DefaultAction ALLOW = fromString("Allow"); + + /** Static value Deny for DefaultAction. */ + public static final DefaultAction DENY = fromString("Deny"); + + /** + * Creates or finds a DefaultAction from its string representation. + * @param name a name to look for + * @return the corresponding DefaultAction + */ + @JsonCreator + public static DefaultAction fromString(String name) { + return fromString(name, DefaultAction.class); + } + + /** + * @return known DefaultAction values + */ + public static Collection values() { + return values(DefaultAction.class); + } +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Event.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Event.java new file mode 100644 index 000000000000..0f0123577cba --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Event.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.containerregistry.v2019_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.containerregistry.v2019_04_01.implementation.ContainerRegistryManager; +import com.microsoft.azure.management.containerregistry.v2019_04_01.implementation.EventInner; + +/** + * Type representing Event. + */ +public interface Event extends HasInner, HasManager { + /** + * @return the eventRequestMessage value. + */ + EventRequestMessage eventRequestMessage(); + + /** + * @return the eventResponseMessage value. + */ + EventResponseMessage eventResponseMessage(); + + /** + * @return the id value. + */ + String id(); + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/EventContent.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/EventContent.java new file mode 100644 index 000000000000..3e259d539372 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/EventContent.java @@ -0,0 +1,202 @@ +/** + * 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.containerregistry.v2019_04_01; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The content of the event request message. + */ +public class EventContent { + /** + * The event ID. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The time at which the event occurred. + */ + @JsonProperty(value = "timestamp") + private DateTime timestamp; + + /** + * The action that encompasses the provided event. + */ + @JsonProperty(value = "action") + private String action; + + /** + * The target of the event. + */ + @JsonProperty(value = "target") + private Target target; + + /** + * The request that generated the event. + */ + @JsonProperty(value = "request") + private Request request; + + /** + * The agent that initiated the event. For most situations, this could be + * from the authorization context of the request. + */ + @JsonProperty(value = "actor") + private Actor actor; + + /** + * The registry node that generated the event. Put differently, while the + * actor initiates the event, the source generates it. + */ + @JsonProperty(value = "source") + private Source source; + + /** + * Get the event ID. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the event ID. + * + * @param id the id value to set + * @return the EventContent object itself. + */ + public EventContent withId(String id) { + this.id = id; + return this; + } + + /** + * Get the time at which the event occurred. + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Set the time at which the event occurred. + * + * @param timestamp the timestamp value to set + * @return the EventContent object itself. + */ + public EventContent withTimestamp(DateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get the action that encompasses the provided event. + * + * @return the action value + */ + public String action() { + return this.action; + } + + /** + * Set the action that encompasses the provided event. + * + * @param action the action value to set + * @return the EventContent object itself. + */ + public EventContent withAction(String action) { + this.action = action; + return this; + } + + /** + * Get the target of the event. + * + * @return the target value + */ + public Target target() { + return this.target; + } + + /** + * Set the target of the event. + * + * @param target the target value to set + * @return the EventContent object itself. + */ + public EventContent withTarget(Target target) { + this.target = target; + return this; + } + + /** + * Get the request that generated the event. + * + * @return the request value + */ + public Request request() { + return this.request; + } + + /** + * Set the request that generated the event. + * + * @param request the request value to set + * @return the EventContent object itself. + */ + public EventContent withRequest(Request request) { + this.request = request; + return this; + } + + /** + * Get the agent that initiated the event. For most situations, this could be from the authorization context of the request. + * + * @return the actor value + */ + public Actor actor() { + return this.actor; + } + + /** + * Set the agent that initiated the event. For most situations, this could be from the authorization context of the request. + * + * @param actor the actor value to set + * @return the EventContent object itself. + */ + public EventContent withActor(Actor actor) { + this.actor = actor; + return this; + } + + /** + * Get the registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. + * + * @return the source value + */ + public Source source() { + return this.source; + } + + /** + * Set the registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. + * + * @param source the source value to set + * @return the EventContent object itself. + */ + public EventContent withSource(Source source) { + this.source = source; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/EventInfo.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/EventInfo.java new file mode 100644 index 000000000000..ef1c41fb408d --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/EventInfo.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.containerregistry.v2019_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.containerregistry.v2019_04_01.implementation.ContainerRegistryManager; +import com.microsoft.azure.management.containerregistry.v2019_04_01.implementation.EventInfoInner; + +/** + * Type representing EventInfo. + */ +public interface EventInfo extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/EventRequestMessage.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/EventRequestMessage.java new file mode 100644 index 000000000000..3b0315c9eb18 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/EventRequestMessage.java @@ -0,0 +1,148 @@ +/** + * 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.containerregistry.v2019_04_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The event request message sent to the service URI. + */ +public class EventRequestMessage { + /** + * The content of the event request message. + */ + @JsonProperty(value = "content") + private EventContent content; + + /** + * The headers of the event request message. + */ + @JsonProperty(value = "headers") + private Map headers; + + /** + * The HTTP method used to send the event request message. + */ + @JsonProperty(value = "method") + private String method; + + /** + * The URI used to send the event request message. + */ + @JsonProperty(value = "requestUri") + private String requestUri; + + /** + * The HTTP message version. + */ + @JsonProperty(value = "version") + private String version; + + /** + * Get the content of the event request message. + * + * @return the content value + */ + public EventContent content() { + return this.content; + } + + /** + * Set the content of the event request message. + * + * @param content the content value to set + * @return the EventRequestMessage object itself. + */ + public EventRequestMessage withContent(EventContent content) { + this.content = content; + return this; + } + + /** + * Get the headers of the event request message. + * + * @return the headers value + */ + public Map headers() { + return this.headers; + } + + /** + * Set the headers of the event request message. + * + * @param headers the headers value to set + * @return the EventRequestMessage object itself. + */ + public EventRequestMessage withHeaders(Map headers) { + this.headers = headers; + return this; + } + + /** + * Get the HTTP method used to send the event request message. + * + * @return the method value + */ + public String method() { + return this.method; + } + + /** + * Set the HTTP method used to send the event request message. + * + * @param method the method value to set + * @return the EventRequestMessage object itself. + */ + public EventRequestMessage withMethod(String method) { + this.method = method; + return this; + } + + /** + * Get the URI used to send the event request message. + * + * @return the requestUri value + */ + public String requestUri() { + return this.requestUri; + } + + /** + * Set the URI used to send the event request message. + * + * @param requestUri the requestUri value to set + * @return the EventRequestMessage object itself. + */ + public EventRequestMessage withRequestUri(String requestUri) { + this.requestUri = requestUri; + return this; + } + + /** + * Get the HTTP message version. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Set the HTTP message version. + * + * @param version the version value to set + * @return the EventRequestMessage object itself. + */ + public EventRequestMessage withVersion(String version) { + this.version = version; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/EventResponseMessage.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/EventResponseMessage.java new file mode 100644 index 000000000000..9c1aafeaddbd --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/EventResponseMessage.java @@ -0,0 +1,148 @@ +/** + * 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.containerregistry.v2019_04_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The event response message received from the service URI. + */ +public class EventResponseMessage { + /** + * The content of the event response message. + */ + @JsonProperty(value = "content") + private String content; + + /** + * The headers of the event response message. + */ + @JsonProperty(value = "headers") + private Map headers; + + /** + * The reason phrase of the event response message. + */ + @JsonProperty(value = "reasonPhrase") + private String reasonPhrase; + + /** + * The status code of the event response message. + */ + @JsonProperty(value = "statusCode") + private String statusCode; + + /** + * The HTTP message version. + */ + @JsonProperty(value = "version") + private String version; + + /** + * Get the content of the event response message. + * + * @return the content value + */ + public String content() { + return this.content; + } + + /** + * Set the content of the event response message. + * + * @param content the content value to set + * @return the EventResponseMessage object itself. + */ + public EventResponseMessage withContent(String content) { + this.content = content; + return this; + } + + /** + * Get the headers of the event response message. + * + * @return the headers value + */ + public Map headers() { + return this.headers; + } + + /** + * Set the headers of the event response message. + * + * @param headers the headers value to set + * @return the EventResponseMessage object itself. + */ + public EventResponseMessage withHeaders(Map headers) { + this.headers = headers; + return this; + } + + /** + * Get the reason phrase of the event response message. + * + * @return the reasonPhrase value + */ + public String reasonPhrase() { + return this.reasonPhrase; + } + + /** + * Set the reason phrase of the event response message. + * + * @param reasonPhrase the reasonPhrase value to set + * @return the EventResponseMessage object itself. + */ + public EventResponseMessage withReasonPhrase(String reasonPhrase) { + this.reasonPhrase = reasonPhrase; + return this; + } + + /** + * Get the status code of the event response message. + * + * @return the statusCode value + */ + public String statusCode() { + return this.statusCode; + } + + /** + * Set the status code of the event response message. + * + * @param statusCode the statusCode value to set + * @return the EventResponseMessage object itself. + */ + public EventResponseMessage withStatusCode(String statusCode) { + this.statusCode = statusCode; + return this; + } + + /** + * Get the HTTP message version. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Set the HTTP message version. + * + * @param version the version value to set + * @return the EventResponseMessage object itself. + */ + public EventResponseMessage withVersion(String version) { + this.version = version; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/IPRule.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/IPRule.java new file mode 100644 index 000000000000..69cfec448971 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/IPRule.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.containerregistry.v2019_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * IP rule with specific IP or IP range in CIDR format. + */ +public class IPRule { + /** + * The action of IP ACL rule. Possible values include: 'Allow'. + */ + @JsonProperty(value = "action") + private Action action; + + /** + * Specifies the IP or IP range in CIDR format. Only IPV4 address is + * allowed. + */ + @JsonProperty(value = "value", required = true) + private String iPAddressOrRange; + + /** + * Get the action of IP ACL rule. Possible values include: 'Allow'. + * + * @return the action value + */ + public Action action() { + return this.action; + } + + /** + * Set the action of IP ACL rule. Possible values include: 'Allow'. + * + * @param action the action value to set + * @return the IPRule object itself. + */ + public IPRule withAction(Action action) { + this.action = action; + return this; + } + + /** + * Get specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. + * + * @return the iPAddressOrRange value + */ + public String iPAddressOrRange() { + return this.iPAddressOrRange; + } + + /** + * Set specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. + * + * @param iPAddressOrRange the iPAddressOrRange value to set + * @return the IPRule object itself. + */ + public IPRule withIPAddressOrRange(String iPAddressOrRange) { + this.iPAddressOrRange = iPAddressOrRange; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/ImportImageParameters.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/ImportImageParameters.java new file mode 100644 index 000000000000..2c2d7f0f636e --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/ImportImageParameters.java @@ -0,0 +1,126 @@ +/** + * 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.containerregistry.v2019_04_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ImportImageParameters model. + */ +public class ImportImageParameters { + /** + * The source of the image. + */ + @JsonProperty(value = "source", required = true) + private ImportSource source; + + /** + * List of strings of the form repo[:tag]. When tag is omitted the source + * will be used (or 'latest' if source tag is also omitted). + */ + @JsonProperty(value = "targetTags") + private List targetTags; + + /** + * List of strings of repository names to do a manifest only copy. No tag + * will be created. + */ + @JsonProperty(value = "untaggedTargetRepositories") + private List untaggedTargetRepositories; + + /** + * When Force, any existing target tags will be overwritten. When NoForce, + * any existing target tags will fail the operation before any copying + * begins. Possible values include: 'NoForce', 'Force'. + */ + @JsonProperty(value = "mode") + private ImportMode mode; + + /** + * Get the source of the image. + * + * @return the source value + */ + public ImportSource source() { + return this.source; + } + + /** + * Set the source of the image. + * + * @param source the source value to set + * @return the ImportImageParameters object itself. + */ + public ImportImageParameters withSource(ImportSource source) { + this.source = source; + return this; + } + + /** + * Get list of strings of the form repo[:tag]. When tag is omitted the source will be used (or 'latest' if source tag is also omitted). + * + * @return the targetTags value + */ + public List targetTags() { + return this.targetTags; + } + + /** + * Set list of strings of the form repo[:tag]. When tag is omitted the source will be used (or 'latest' if source tag is also omitted). + * + * @param targetTags the targetTags value to set + * @return the ImportImageParameters object itself. + */ + public ImportImageParameters withTargetTags(List targetTags) { + this.targetTags = targetTags; + return this; + } + + /** + * Get list of strings of repository names to do a manifest only copy. No tag will be created. + * + * @return the untaggedTargetRepositories value + */ + public List untaggedTargetRepositories() { + return this.untaggedTargetRepositories; + } + + /** + * Set list of strings of repository names to do a manifest only copy. No tag will be created. + * + * @param untaggedTargetRepositories the untaggedTargetRepositories value to set + * @return the ImportImageParameters object itself. + */ + public ImportImageParameters withUntaggedTargetRepositories(List untaggedTargetRepositories) { + this.untaggedTargetRepositories = untaggedTargetRepositories; + return this; + } + + /** + * Get when Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins. Possible values include: 'NoForce', 'Force'. + * + * @return the mode value + */ + public ImportMode mode() { + return this.mode; + } + + /** + * Set when Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins. Possible values include: 'NoForce', 'Force'. + * + * @param mode the mode value to set + * @return the ImportImageParameters object itself. + */ + public ImportImageParameters withMode(ImportMode mode) { + this.mode = mode; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/ImportMode.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/ImportMode.java new file mode 100644 index 000000000000..3e7ee4d20359 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/ImportMode.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.containerregistry.v2019_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ImportMode. + */ +public final class ImportMode extends ExpandableStringEnum { + /** Static value NoForce for ImportMode. */ + public static final ImportMode NO_FORCE = fromString("NoForce"); + + /** Static value Force for ImportMode. */ + public static final ImportMode FORCE = fromString("Force"); + + /** + * Creates or finds a ImportMode from its string representation. + * @param name a name to look for + * @return the corresponding ImportMode + */ + @JsonCreator + public static ImportMode fromString(String name) { + return fromString(name, ImportMode.class); + } + + /** + * @return known ImportMode values + */ + public static Collection values() { + return values(ImportMode.class); + } +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/ImportSource.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/ImportSource.java new file mode 100644 index 000000000000..906cef0af406 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/ImportSource.java @@ -0,0 +1,132 @@ +/** + * 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.containerregistry.v2019_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ImportSource model. + */ +public class ImportSource { + /** + * The resource identifier of the source Azure Container Registry. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /** + * The address of the source registry (e.g. 'mcr.microsoft.com'). + */ + @JsonProperty(value = "registryUri") + private String registryUri; + + /** + * Credentials used when importing from a registry uri. + */ + @JsonProperty(value = "credentials") + private ImportSourceCredentials credentials; + + /** + * Repository name of the source image. + * Specify an image by repository ('hello-world'). This will use the + * 'latest' tag. + * Specify an image by tag ('hello-world:latest'). + * Specify an image by sha256-based manifest digest + * ('hello-world@sha256:abc123'). + */ + @JsonProperty(value = "sourceImage", required = true) + private String sourceImage; + + /** + * Get the resource identifier of the source Azure Container Registry. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resource identifier of the source Azure Container Registry. + * + * @param resourceId the resourceId value to set + * @return the ImportSource object itself. + */ + public ImportSource withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the address of the source registry (e.g. 'mcr.microsoft.com'). + * + * @return the registryUri value + */ + public String registryUri() { + return this.registryUri; + } + + /** + * Set the address of the source registry (e.g. 'mcr.microsoft.com'). + * + * @param registryUri the registryUri value to set + * @return the ImportSource object itself. + */ + public ImportSource withRegistryUri(String registryUri) { + this.registryUri = registryUri; + return this; + } + + /** + * Get credentials used when importing from a registry uri. + * + * @return the credentials value + */ + public ImportSourceCredentials credentials() { + return this.credentials; + } + + /** + * Set credentials used when importing from a registry uri. + * + * @param credentials the credentials value to set + * @return the ImportSource object itself. + */ + public ImportSource withCredentials(ImportSourceCredentials credentials) { + this.credentials = credentials; + return this; + } + + /** + * Get repository name of the source image. + Specify an image by repository ('hello-world'). This will use the 'latest' tag. + Specify an image by tag ('hello-world:latest'). + Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). + * + * @return the sourceImage value + */ + public String sourceImage() { + return this.sourceImage; + } + + /** + * Set repository name of the source image. + Specify an image by repository ('hello-world'). This will use the 'latest' tag. + Specify an image by tag ('hello-world:latest'). + Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). + * + * @param sourceImage the sourceImage value to set + * @return the ImportSource object itself. + */ + public ImportSource withSourceImage(String sourceImage) { + this.sourceImage = sourceImage; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/ImportSourceCredentials.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/ImportSourceCredentials.java new file mode 100644 index 000000000000..2849dd319162 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/ImportSourceCredentials.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.containerregistry.v2019_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ImportSourceCredentials model. + */ +public class ImportSourceCredentials { + /** + * The username to authenticate with the source registry. + */ + @JsonProperty(value = "username") + private String username; + + /** + * The password used to authenticate with the source registry. + */ + @JsonProperty(value = "password", required = true) + private String password; + + /** + * Get the username to authenticate with the source registry. + * + * @return the username value + */ + public String username() { + return this.username; + } + + /** + * Set the username to authenticate with the source registry. + * + * @param username the username value to set + * @return the ImportSourceCredentials object itself. + */ + public ImportSourceCredentials withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password used to authenticate with the source registry. + * + * @return the password value + */ + public String password() { + return this.password; + } + + /** + * Set the password used to authenticate with the source registry. + * + * @param password the password value to set + * @return the ImportSourceCredentials object itself. + */ + public ImportSourceCredentials withPassword(String password) { + this.password = password; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/NetworkRuleSet.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/NetworkRuleSet.java new file mode 100644 index 000000000000..02807b2b797a --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/NetworkRuleSet.java @@ -0,0 +1,97 @@ +/** + * 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.containerregistry.v2019_04_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The network rule set for a container registry. + */ +public class NetworkRuleSet { + /** + * The default action of allow or deny when no other rules match. Possible + * values include: 'Allow', 'Deny'. + */ + @JsonProperty(value = "defaultAction", required = true) + private DefaultAction defaultAction; + + /** + * The virtual network rules. + */ + @JsonProperty(value = "virtualNetworkRules") + private List virtualNetworkRules; + + /** + * The IP ACL rules. + */ + @JsonProperty(value = "ipRules") + private List ipRules; + + /** + * Get the default action of allow or deny when no other rules match. Possible values include: 'Allow', 'Deny'. + * + * @return the defaultAction value + */ + public DefaultAction defaultAction() { + return this.defaultAction; + } + + /** + * Set the default action of allow or deny when no other rules match. Possible values include: 'Allow', 'Deny'. + * + * @param defaultAction the defaultAction value to set + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withDefaultAction(DefaultAction defaultAction) { + this.defaultAction = defaultAction; + return this; + } + + /** + * Get the virtual network rules. + * + * @return the virtualNetworkRules value + */ + public List virtualNetworkRules() { + return this.virtualNetworkRules; + } + + /** + * Set the virtual network rules. + * + * @param virtualNetworkRules the virtualNetworkRules value to set + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withVirtualNetworkRules(List virtualNetworkRules) { + this.virtualNetworkRules = virtualNetworkRules; + return this; + } + + /** + * Get the IP ACL rules. + * + * @return the ipRules value + */ + public List ipRules() { + return this.ipRules; + } + + /** + * Set the IP ACL rules. + * + * @param ipRules the ipRules value to set + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withIpRules(List ipRules) { + this.ipRules = ipRules; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/OperationDefinition.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/OperationDefinition.java new file mode 100644 index 000000000000..8a02d3c76f17 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/OperationDefinition.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.containerregistry.v2019_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.containerregistry.v2019_04_01.implementation.ContainerRegistryManager; +import com.microsoft.azure.management.containerregistry.v2019_04_01.implementation.OperationDefinitionInner; + +/** + * Type representing OperationDefinition. + */ +public interface OperationDefinition extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplayDefinition display(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the origin value. + */ + String origin(); + + /** + * @return the serviceSpecification value. + */ + OperationServiceSpecificationDefinition serviceSpecification(); + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/OperationDisplayDefinition.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/OperationDisplayDefinition.java new file mode 100644 index 000000000000..75b34bf154c6 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/OperationDisplayDefinition.java @@ -0,0 +1,121 @@ +/** + * 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.containerregistry.v2019_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The display information for a container registry operation. + */ +public class OperationDisplayDefinition { + /** + * The resource provider name: Microsoft.ContainerRegistry. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * The resource on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * The operation that users can perform. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * The description for the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the resource provider name: Microsoft.ContainerRegistry. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set the resource provider name: Microsoft.ContainerRegistry. + * + * @param provider the provider value to set + * @return the OperationDisplayDefinition object itself. + */ + public OperationDisplayDefinition withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource on which the operation is performed. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource on which the operation is performed. + * + * @param resource the resource value to set + * @return the OperationDisplayDefinition object itself. + */ + public OperationDisplayDefinition withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation that users can perform. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation that users can perform. + * + * @param operation the operation value to set + * @return the OperationDisplayDefinition object itself. + */ + public OperationDisplayDefinition withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description for the operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description for the operation. + * + * @param description the description value to set + * @return the OperationDisplayDefinition object itself. + */ + public OperationDisplayDefinition withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/OperationMetricSpecificationDefinition.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/OperationMetricSpecificationDefinition.java new file mode 100644 index 000000000000..79809f132191 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/OperationMetricSpecificationDefinition.java @@ -0,0 +1,173 @@ +/** + * 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.containerregistry.v2019_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The definition of Azure Monitoring metric. + */ +public class OperationMetricSpecificationDefinition { + /** + * Metric name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Metric display name. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Metric description. + */ + @JsonProperty(value = "displayDescription") + private String displayDescription; + + /** + * Metric unit. + */ + @JsonProperty(value = "unit") + private String unit; + + /** + * Metric aggregation type. + */ + @JsonProperty(value = "aggregationType") + private String aggregationType; + + /** + * Internal metric name. + */ + @JsonProperty(value = "internalMetricName") + private String internalMetricName; + + /** + * Get metric name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set metric name. + * + * @param name the name value to set + * @return the OperationMetricSpecificationDefinition object itself. + */ + public OperationMetricSpecificationDefinition withName(String name) { + this.name = name; + return this; + } + + /** + * Get metric display name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set metric display name. + * + * @param displayName the displayName value to set + * @return the OperationMetricSpecificationDefinition object itself. + */ + public OperationMetricSpecificationDefinition withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get metric description. + * + * @return the displayDescription value + */ + public String displayDescription() { + return this.displayDescription; + } + + /** + * Set metric description. + * + * @param displayDescription the displayDescription value to set + * @return the OperationMetricSpecificationDefinition object itself. + */ + public OperationMetricSpecificationDefinition withDisplayDescription(String displayDescription) { + this.displayDescription = displayDescription; + return this; + } + + /** + * Get metric unit. + * + * @return the unit value + */ + public String unit() { + return this.unit; + } + + /** + * Set metric unit. + * + * @param unit the unit value to set + * @return the OperationMetricSpecificationDefinition object itself. + */ + public OperationMetricSpecificationDefinition withUnit(String unit) { + this.unit = unit; + return this; + } + + /** + * Get metric aggregation type. + * + * @return the aggregationType value + */ + public String aggregationType() { + return this.aggregationType; + } + + /** + * Set metric aggregation type. + * + * @param aggregationType the aggregationType value to set + * @return the OperationMetricSpecificationDefinition object itself. + */ + public OperationMetricSpecificationDefinition withAggregationType(String aggregationType) { + this.aggregationType = aggregationType; + return this; + } + + /** + * Get internal metric name. + * + * @return the internalMetricName value + */ + public String internalMetricName() { + return this.internalMetricName; + } + + /** + * Set internal metric name. + * + * @param internalMetricName the internalMetricName value to set + * @return the OperationMetricSpecificationDefinition object itself. + */ + public OperationMetricSpecificationDefinition withInternalMetricName(String internalMetricName) { + this.internalMetricName = internalMetricName; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/OperationServiceSpecificationDefinition.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/OperationServiceSpecificationDefinition.java new file mode 100644 index 000000000000..b7b56a5c89d9 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/OperationServiceSpecificationDefinition.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.containerregistry.v2019_04_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The definition of Azure Monitoring metrics list. + */ +public class OperationServiceSpecificationDefinition { + /** + * A list of Azure Monitoring metrics definition. + */ + @JsonProperty(value = "metricSpecifications") + private List metricSpecifications; + + /** + * Get a list of Azure Monitoring metrics definition. + * + * @return the metricSpecifications value + */ + public List metricSpecifications() { + return this.metricSpecifications; + } + + /** + * Set a list of Azure Monitoring metrics definition. + * + * @param metricSpecifications the metricSpecifications value to set + * @return the OperationServiceSpecificationDefinition object itself. + */ + public OperationServiceSpecificationDefinition withMetricSpecifications(List metricSpecifications) { + this.metricSpecifications = metricSpecifications; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Operations.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Operations.java new file mode 100644 index 000000000000..5c01ced9a6e3 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_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.containerregistry.v2019_04_01; + +import rx.Observable; +import com.microsoft.azure.management.containerregistry.v2019_04_01.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available Azure Container Registry REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/PasswordName.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/PasswordName.java new file mode 100644 index 000000000000..510a2ba47d06 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/PasswordName.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.containerregistry.v2019_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for PasswordName. + */ +public enum PasswordName { + /** Enum value password. */ + PASSWORD("password"), + + /** Enum value password2. */ + PASSWORD2("password2"); + + /** The actual serialized value for a PasswordName instance. */ + private String value; + + PasswordName(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PasswordName instance. + * + * @param value the serialized value to parse. + * @return the parsed PasswordName object, or null if unable to parse. + */ + @JsonCreator + public static PasswordName fromString(String value) { + PasswordName[] items = PasswordName.values(); + for (PasswordName item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/PolicyStatus.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/PolicyStatus.java new file mode 100644 index 000000000000..ffd45718f9ec --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/PolicyStatus.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.containerregistry.v2019_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PolicyStatus. + */ +public final class PolicyStatus extends ExpandableStringEnum { + /** Static value enabled for PolicyStatus. */ + public static final PolicyStatus ENABLED = fromString("enabled"); + + /** Static value disabled for PolicyStatus. */ + public static final PolicyStatus DISABLED = fromString("disabled"); + + /** + * Creates or finds a PolicyStatus from its string representation. + * @param name a name to look for + * @return the corresponding PolicyStatus + */ + @JsonCreator + public static PolicyStatus fromString(String name) { + return fromString(name, PolicyStatus.class); + } + + /** + * @return known PolicyStatus values + */ + public static Collection values() { + return values(PolicyStatus.class); + } +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/QuarantinePolicy.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/QuarantinePolicy.java new file mode 100644 index 000000000000..a33fb7aac073 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/QuarantinePolicy.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.containerregistry.v2019_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An object that represents quarantine policy for a container registry. + */ +public class QuarantinePolicy { + /** + * The value that indicates whether the policy is enabled or not. Possible + * values include: 'enabled', 'disabled'. + */ + @JsonProperty(value = "status") + private PolicyStatus status; + + /** + * Get the value that indicates whether the policy is enabled or not. Possible values include: 'enabled', 'disabled'. + * + * @return the status value + */ + public PolicyStatus status() { + return this.status; + } + + /** + * Set the value that indicates whether the policy is enabled or not. Possible values include: 'enabled', 'disabled'. + * + * @param status the status value to set + * @return the QuarantinePolicy object itself. + */ + public QuarantinePolicy withStatus(PolicyStatus status) { + this.status = status; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegenerateCredentialParameters.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegenerateCredentialParameters.java new file mode 100644 index 000000000000..30d62dcbcd96 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegenerateCredentialParameters.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.containerregistry.v2019_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The parameters used to regenerate the login credential. + */ +public class RegenerateCredentialParameters { + /** + * Specifies name of the password which should be regenerated -- password + * or password2. Possible values include: 'password', 'password2'. + */ + @JsonProperty(value = "name", required = true) + private PasswordName name; + + /** + * Get specifies name of the password which should be regenerated -- password or password2. Possible values include: 'password', 'password2'. + * + * @return the name value + */ + public PasswordName name() { + return this.name; + } + + /** + * Set specifies name of the password which should be regenerated -- password or password2. Possible values include: 'password', 'password2'. + * + * @param name the name value to set + * @return the RegenerateCredentialParameters object itself. + */ + public RegenerateCredentialParameters withName(PasswordName name) { + this.name = name; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Registries.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Registries.java index 62e6604496fb..8ca4dc46f66e 100644 --- a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Registries.java +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Registries.java @@ -8,14 +8,65 @@ package com.microsoft.azure.management.containerregistry.v2019_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 rx.Completable; +import com.microsoft.azure.management.containerregistry.v2019_04_01.implementation.RegistryPoliciesInner; import com.microsoft.azure.management.containerregistry.v2019_04_01.implementation.RegistriesInner; import com.microsoft.azure.arm.model.HasInner; /** * Type representing Registries. */ -public interface Registries extends HasInner { +public interface Registries extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Copies an image to this container registry from the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param parameters The parameters specifying the image to copy and the source container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable importImageAsync(String resourceGroupName, String registryName, ImportImageParameters parameters); + + /** + * Lists the login credentials for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listCredentialsAsync(String resourceGroupName, String registryName); + + /** + * Regenerates one of the login credentials for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param name Specifies name of the password which should be regenerated -- password or password2. Possible values include: 'password', 'password2' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable regenerateCredentialAsync(String resourceGroupName, String registryName, PasswordName name); + + /** + * Updates the policies for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registryPoliciesUpdateParameters The parameters for updating policies of a container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updatePoliciesAsync(String resourceGroupName, String registryName, RegistryPoliciesInner registryPoliciesUpdateParameters); + /** * Schedules a new run based on the request parameters and add it to the run queue. * @@ -37,4 +88,33 @@ public interface Registries extends HasInner { */ Observable getBuildSourceUploadUrlAsync(String resourceGroupName, String registryName); + /** + * Checks whether the container registry name is available for use. The name must contain only alphanumeric characters, be globally unique, and between 5 and 50 characters in length. + * + * @param name The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkNameAvailabilityAsync(String name); + + /** + * Gets the quota usages for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listUsagesAsync(String resourceGroupName, String registryName); + + /** + * Lists the policies for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listPoliciesAsync(String resourceGroupName, String registryName); + } diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Registry.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Registry.java new file mode 100644 index 000000000000..d51bdee939a3 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Registry.java @@ -0,0 +1,205 @@ +/** + * 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.containerregistry.v2019_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.containerregistry.v2019_04_01.implementation.ContainerRegistryManager; +import org.joda.time.DateTime; +import com.microsoft.azure.management.containerregistry.v2019_04_01.implementation.RegistryInner; + +/** + * Type representing Registry. + */ +public interface Registry extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the adminUserEnabled value. + */ + Boolean adminUserEnabled(); + + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the loginServer value. + */ + String loginServer(); + + /** + * @return the networkRuleSet value. + */ + NetworkRuleSet networkRuleSet(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * @return the status value. + */ + Status status(); + + /** + * @return the storageAccount value. + */ + StorageAccountProperties storageAccount(); + + /** + * The entirety of the Registry definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithSku, DefinitionStages.WithCreate { + } + + /** + * Grouping of Registry definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Registry definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the Registry definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the registry definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The SKU of the container registry + * @return the next definition stage +*/ + WithCreate withSku(Sku sku); + } + + /** + * The stage of the registry definition allowing to specify AdminUserEnabled. + */ + interface WithAdminUserEnabled { + /** + * Specifies adminUserEnabled. + * @param adminUserEnabled The value that indicates whether the admin user is enabled + * @return the next definition stage + */ + WithCreate withAdminUserEnabled(Boolean adminUserEnabled); + } + + /** + * The stage of the registry definition allowing to specify NetworkRuleSet. + */ + interface WithNetworkRuleSet { + /** + * Specifies networkRuleSet. + * @param networkRuleSet The network rule set for a container registry + * @return the next definition stage + */ + WithCreate withNetworkRuleSet(NetworkRuleSet networkRuleSet); + } + + /** + * The stage of the registry definition allowing to specify StorageAccount. + */ + interface WithStorageAccount { + /** + * Specifies storageAccount. + * @param storageAccount The properties of the storage account for the container registry. Only applicable to Classic SKU + * @return the next definition stage + */ + WithCreate withStorageAccount(StorageAccountProperties storageAccount); + } + + /** + * 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.WithAdminUserEnabled, DefinitionStages.WithNetworkRuleSet, DefinitionStages.WithStorageAccount { + } + } + /** + * The template for a Registry update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAdminUserEnabled, UpdateStages.WithNetworkRuleSet, UpdateStages.WithSku, UpdateStages.WithStorageAccount { + } + + /** + * Grouping of Registry update stages. + */ + interface UpdateStages { + /** + * The stage of the registry update allowing to specify AdminUserEnabled. + */ + interface WithAdminUserEnabled { + /** + * Specifies adminUserEnabled. + * @param adminUserEnabled The value that indicates whether the admin user is enabled + * @return the next update stage + */ + Update withAdminUserEnabled(Boolean adminUserEnabled); + } + + /** + * The stage of the registry update allowing to specify NetworkRuleSet. + */ + interface WithNetworkRuleSet { + /** + * Specifies networkRuleSet. + * @param networkRuleSet The network rule set for a container registry + * @return the next update stage + */ + Update withNetworkRuleSet(NetworkRuleSet networkRuleSet); + } + + /** + * The stage of the registry update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The SKU of the container registry + * @return the next update stage + */ + Update withSku(Sku sku); + } + + /** + * The stage of the registry update allowing to specify StorageAccount. + */ + interface WithStorageAccount { + /** + * Specifies storageAccount. + * @param storageAccount The parameters of a storage account for the container registry. Only applicable to Classic SKU. If specified, the storage account must be in the same physical location as the container registry + * @return the next update stage + */ + Update withStorageAccount(StorageAccountProperties storageAccount); + } + + } +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryListCredentialsResult.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryListCredentialsResult.java new file mode 100644 index 000000000000..fd16a426d0f7 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryListCredentialsResult.java @@ -0,0 +1,31 @@ +/** + * 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.containerregistry.v2019_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.containerregistry.v2019_04_01.implementation.ContainerRegistryManager; +import com.microsoft.azure.management.containerregistry.v2019_04_01.implementation.RegistryListCredentialsResultInner; +import java.util.List; + +/** + * Type representing RegistryListCredentialsResult. + */ +public interface RegistryListCredentialsResult extends HasInner, HasManager { + /** + * @return the passwords value. + */ + List passwords(); + + /** + * @return the username value. + */ + String username(); + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryNameCheckRequest.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryNameCheckRequest.java new file mode 100644 index 000000000000..988cf1bfadfa --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryNameCheckRequest.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.containerregistry.v2019_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A request to check whether a container registry name is available. + */ +public class RegistryNameCheckRequest { + /** + * The name of the container registry. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The resource type of the container registry. This field must be set to + * 'Microsoft.ContainerRegistry/registries'. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * Creates an instance of RegistryNameCheckRequest class. + * @param name the name of the container registry. + */ + public RegistryNameCheckRequest() { + type = "Microsoft.ContainerRegistry/registries"; + } + + /** + * Get the name of the container registry. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the container registry. + * + * @param name the name value to set + * @return the RegistryNameCheckRequest object itself. + */ + public RegistryNameCheckRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. + * + * @param type the type value to set + * @return the RegistryNameCheckRequest object itself. + */ + public RegistryNameCheckRequest withType(String type) { + this.type = type; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryNameStatus.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryNameStatus.java new file mode 100644 index 000000000000..d9a515ddd480 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryNameStatus.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.containerregistry.v2019_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.containerregistry.v2019_04_01.implementation.ContainerRegistryManager; +import com.microsoft.azure.management.containerregistry.v2019_04_01.implementation.RegistryNameStatusInner; + +/** + * Type representing RegistryNameStatus. + */ +public interface RegistryNameStatus extends HasInner, HasManager { + /** + * @return the message value. + */ + String message(); + + /** + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * @return the reason value. + */ + String reason(); + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryPassword.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryPassword.java new file mode 100644 index 000000000000..52266ab441b9 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryPassword.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.containerregistry.v2019_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The login password for the container registry. + */ +public class RegistryPassword { + /** + * The password name. Possible values include: 'password', 'password2'. + */ + @JsonProperty(value = "name") + private PasswordName name; + + /** + * The password value. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the password name. Possible values include: 'password', 'password2'. + * + * @return the name value + */ + public PasswordName name() { + return this.name; + } + + /** + * Set the password name. Possible values include: 'password', 'password2'. + * + * @param name the name value to set + * @return the RegistryPassword object itself. + */ + public RegistryPassword withName(PasswordName name) { + this.name = name; + return this; + } + + /** + * Get the password value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the password value. + * + * @param value the value value to set + * @return the RegistryPassword object itself. + */ + public RegistryPassword withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryPolicies.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryPolicies.java new file mode 100644 index 000000000000..5c9a50e2e5d3 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryPolicies.java @@ -0,0 +1,30 @@ +/** + * 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.containerregistry.v2019_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.containerregistry.v2019_04_01.implementation.ContainerRegistryManager; +import com.microsoft.azure.management.containerregistry.v2019_04_01.implementation.RegistryPoliciesInner; + +/** + * Type representing RegistryPolicies. + */ +public interface RegistryPolicies extends HasInner, HasManager { + /** + * @return the quarantinePolicy value. + */ + QuarantinePolicy quarantinePolicy(); + + /** + * @return the trustPolicy value. + */ + TrustPolicy trustPolicy(); + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryUpdateParameters.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryUpdateParameters.java new file mode 100644 index 000000000000..a074795e3544 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryUpdateParameters.java @@ -0,0 +1,152 @@ +/** + * 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.containerregistry.v2019_04_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The parameters for updating a container registry. + */ +@JsonFlatten +public class RegistryUpdateParameters { + /** + * The tags for the container registry. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * The SKU of the container registry. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * The value that indicates whether the admin user is enabled. + */ + @JsonProperty(value = "properties.adminUserEnabled") + private Boolean adminUserEnabled; + + /** + * The parameters of a storage account for the container registry. Only + * applicable to Classic SKU. If specified, the storage account must be in + * the same physical location as the container registry. + */ + @JsonProperty(value = "properties.storageAccount") + private StorageAccountProperties storageAccount; + + /** + * The network rule set for a container registry. + */ + @JsonProperty(value = "properties.networkRuleSet") + private NetworkRuleSet networkRuleSet; + + /** + * Get the tags for the container registry. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags for the container registry. + * + * @param tags the tags value to set + * @return the RegistryUpdateParameters object itself. + */ + public RegistryUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the SKU of the container registry. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the SKU of the container registry. + * + * @param sku the sku value to set + * @return the RegistryUpdateParameters object itself. + */ + public RegistryUpdateParameters withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the value that indicates whether the admin user is enabled. + * + * @return the adminUserEnabled value + */ + public Boolean adminUserEnabled() { + return this.adminUserEnabled; + } + + /** + * Set the value that indicates whether the admin user is enabled. + * + * @param adminUserEnabled the adminUserEnabled value to set + * @return the RegistryUpdateParameters object itself. + */ + public RegistryUpdateParameters withAdminUserEnabled(Boolean adminUserEnabled) { + this.adminUserEnabled = adminUserEnabled; + return this; + } + + /** + * Get the parameters of a storage account for the container registry. Only applicable to Classic SKU. If specified, the storage account must be in the same physical location as the container registry. + * + * @return the storageAccount value + */ + public StorageAccountProperties storageAccount() { + return this.storageAccount; + } + + /** + * Set the parameters of a storage account for the container registry. Only applicable to Classic SKU. If specified, the storage account must be in the same physical location as the container registry. + * + * @param storageAccount the storageAccount value to set + * @return the RegistryUpdateParameters object itself. + */ + public RegistryUpdateParameters withStorageAccount(StorageAccountProperties storageAccount) { + this.storageAccount = storageAccount; + return this; + } + + /** + * Get the network rule set for a container registry. + * + * @return the networkRuleSet value + */ + public NetworkRuleSet networkRuleSet() { + return this.networkRuleSet; + } + + /** + * Set the network rule set for a container registry. + * + * @param networkRuleSet the networkRuleSet value to set + * @return the RegistryUpdateParameters object itself. + */ + public RegistryUpdateParameters withNetworkRuleSet(NetworkRuleSet networkRuleSet) { + this.networkRuleSet = networkRuleSet; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryUsage.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryUsage.java new file mode 100644 index 000000000000..9d5bd90c6df0 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryUsage.java @@ -0,0 +1,121 @@ +/** + * 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.containerregistry.v2019_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The quota usage for a container registry. + */ +public class RegistryUsage { + /** + * The name of the usage. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The limit of the usage. + */ + @JsonProperty(value = "limit") + private Long limit; + + /** + * The current value of the usage. + */ + @JsonProperty(value = "currentValue") + private Long currentValue; + + /** + * The unit of measurement. Possible values include: 'Count', 'Bytes'. + */ + @JsonProperty(value = "unit") + private RegistryUsageUnit unit; + + /** + * Get the name of the usage. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the usage. + * + * @param name the name value to set + * @return the RegistryUsage object itself. + */ + public RegistryUsage withName(String name) { + this.name = name; + return this; + } + + /** + * Get the limit of the usage. + * + * @return the limit value + */ + public Long limit() { + return this.limit; + } + + /** + * Set the limit of the usage. + * + * @param limit the limit value to set + * @return the RegistryUsage object itself. + */ + public RegistryUsage withLimit(Long limit) { + this.limit = limit; + return this; + } + + /** + * Get the current value of the usage. + * + * @return the currentValue value + */ + public Long currentValue() { + return this.currentValue; + } + + /** + * Set the current value of the usage. + * + * @param currentValue the currentValue value to set + * @return the RegistryUsage object itself. + */ + public RegistryUsage withCurrentValue(Long currentValue) { + this.currentValue = currentValue; + return this; + } + + /** + * Get the unit of measurement. Possible values include: 'Count', 'Bytes'. + * + * @return the unit value + */ + public RegistryUsageUnit unit() { + return this.unit; + } + + /** + * Set the unit of measurement. Possible values include: 'Count', 'Bytes'. + * + * @param unit the unit value to set + * @return the RegistryUsage object itself. + */ + public RegistryUsage withUnit(RegistryUsageUnit unit) { + this.unit = unit; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryUsageListResult.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryUsageListResult.java new file mode 100644 index 000000000000..949cd7cb1fe5 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryUsageListResult.java @@ -0,0 +1,26 @@ +/** + * 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.containerregistry.v2019_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.containerregistry.v2019_04_01.implementation.ContainerRegistryManager; +import com.microsoft.azure.management.containerregistry.v2019_04_01.implementation.RegistryUsageListResultInner; +import java.util.List; + +/** + * Type representing RegistryUsageListResult. + */ +public interface RegistryUsageListResult extends HasInner, HasManager { + /** + * @return the value value. + */ + List value(); + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryUsageUnit.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryUsageUnit.java new file mode 100644 index 000000000000..db9d7d1acd75 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/RegistryUsageUnit.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.containerregistry.v2019_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for RegistryUsageUnit. + */ +public final class RegistryUsageUnit extends ExpandableStringEnum { + /** Static value Count for RegistryUsageUnit. */ + public static final RegistryUsageUnit COUNT = fromString("Count"); + + /** Static value Bytes for RegistryUsageUnit. */ + public static final RegistryUsageUnit BYTES = fromString("Bytes"); + + /** + * Creates or finds a RegistryUsageUnit from its string representation. + * @param name a name to look for + * @return the corresponding RegistryUsageUnit + */ + @JsonCreator + public static RegistryUsageUnit fromString(String name) { + return fromString(name, RegistryUsageUnit.class); + } + + /** + * @return known RegistryUsageUnit values + */ + public static Collection values() { + return values(RegistryUsageUnit.class); + } +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Replication.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Replication.java new file mode 100644 index 000000000000..9e17a41851a4 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Replication.java @@ -0,0 +1,145 @@ +/** + * 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.containerregistry.v2019_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.containerregistry.v2019_04_01.implementation.ReplicationInner; +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.containerregistry.v2019_04_01.implementation.ContainerRegistryManager; +import java.util.Map; + +/** + * Type representing Replication. + */ +public interface Replication extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * @return the status value. + */ + Status status(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the Replication definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithRegistry, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of Replication definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Replication definition. + */ + interface Blank extends WithRegistry { + } + + /** + * The stage of the replication definition allowing to specify Registry. + */ + interface WithRegistry { + /** + * Specifies resourceGroupName, registryName. + * @param resourceGroupName The name of the resource group to which the container registry belongs + * @param registryName The name of the container registry + * @return the next definition stage + */ + WithLocation withExistingRegistry(String resourceGroupName, String registryName); + } + + /** + * The stage of the replication definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource. This cannot be changed after the resource is created + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the replication definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags of the resource + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * 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.WithTags { + } + } + /** + * The template for a Replication update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithTags { + } + + /** + * Grouping of Replication update stages. + */ + interface UpdateStages { + /** + * The stage of the replication update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags of the resource + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/ReplicationUpdateParameters.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/ReplicationUpdateParameters.java new file mode 100644 index 000000000000..5436497677f3 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/ReplicationUpdateParameters.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.containerregistry.v2019_04_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The parameters for updating a replication. + */ +public class ReplicationUpdateParameters { + /** + * The tags for the replication. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the tags for the replication. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags for the replication. + * + * @param tags the tags value to set + * @return the ReplicationUpdateParameters object itself. + */ + public ReplicationUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Replications.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Replications.java new file mode 100644 index 000000000000..713332b27c37 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Replications.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.containerregistry.v2019_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.containerregistry.v2019_04_01.implementation.ReplicationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Replications. + */ +public interface Replications extends SupportsCreating, HasInner { + /** + * Gets the properties of the specified replication. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String registryName, String replicationName); + + /** + * Lists all the replications for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String registryName); + + /** + * Deletes a replication from a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String registryName, String replicationName); + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Request.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Request.java new file mode 100644 index 000000000000..0003f24cc2a5 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Request.java @@ -0,0 +1,150 @@ +/** + * 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.containerregistry.v2019_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The request that generated the event. + */ +public class Request { + /** + * The ID of the request that initiated the event. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The IP or hostname and possibly port of the client connection that + * initiated the event. This is the RemoteAddr from the standard http + * request. + */ + @JsonProperty(value = "addr") + private String addr; + + /** + * The externally accessible hostname of the registry instance, as + * specified by the http host header on incoming requests. + */ + @JsonProperty(value = "host") + private String host; + + /** + * The request method that generated the event. + */ + @JsonProperty(value = "method") + private String method; + + /** + * The user agent header of the request. + */ + @JsonProperty(value = "useragent") + private String useragent; + + /** + * Get the ID of the request that initiated the event. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the ID of the request that initiated the event. + * + * @param id the id value to set + * @return the Request object itself. + */ + public Request withId(String id) { + this.id = id; + return this; + } + + /** + * Get the IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the standard http request. + * + * @return the addr value + */ + public String addr() { + return this.addr; + } + + /** + * Set the IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the standard http request. + * + * @param addr the addr value to set + * @return the Request object itself. + */ + public Request withAddr(String addr) { + this.addr = addr; + return this; + } + + /** + * Get the externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. + * + * @return the host value + */ + public String host() { + return this.host; + } + + /** + * Set the externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. + * + * @param host the host value to set + * @return the Request object itself. + */ + public Request withHost(String host) { + this.host = host; + return this; + } + + /** + * Get the request method that generated the event. + * + * @return the method value + */ + public String method() { + return this.method; + } + + /** + * Set the request method that generated the event. + * + * @param method the method value to set + * @return the Request object itself. + */ + public Request withMethod(String method) { + this.method = method; + return this; + } + + /** + * Get the user agent header of the request. + * + * @return the useragent value + */ + public String useragent() { + return this.useragent; + } + + /** + * Set the user agent header of the request. + * + * @param useragent the useragent value to set + * @return the Request object itself. + */ + public Request withUseragent(String useragent) { + this.useragent = useragent; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Sku.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Sku.java new file mode 100644 index 000000000000..a4045adbcf83 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Sku.java @@ -0,0 +1,60 @@ +/** + * 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.containerregistry.v2019_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The SKU of a container registry. + */ +public class Sku { + /** + * The SKU name of the container registry. Required for registry creation. + * Possible values include: 'Classic', 'Basic', 'Standard', 'Premium'. + */ + @JsonProperty(value = "name", required = true) + private SkuName name; + + /** + * The SKU tier based on the SKU name. Possible values include: 'Classic', + * 'Basic', 'Standard', 'Premium'. + */ + @JsonProperty(value = "tier", access = JsonProperty.Access.WRITE_ONLY) + private SkuTier tier; + + /** + * Get the SKU name of the container registry. Required for registry creation. Possible values include: 'Classic', 'Basic', 'Standard', 'Premium'. + * + * @return the name value + */ + public SkuName name() { + return this.name; + } + + /** + * Set the SKU name of the container registry. Required for registry creation. Possible values include: 'Classic', 'Basic', 'Standard', 'Premium'. + * + * @param name the name value to set + * @return the Sku object itself. + */ + public Sku withName(SkuName name) { + this.name = name; + return this; + } + + /** + * Get the SKU tier based on the SKU name. Possible values include: 'Classic', 'Basic', 'Standard', 'Premium'. + * + * @return the tier value + */ + public SkuTier tier() { + return this.tier; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/SkuName.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/SkuName.java new file mode 100644 index 000000000000..ce4b0ff321a1 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/SkuName.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.containerregistry.v2019_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SkuName. + */ +public final class SkuName extends ExpandableStringEnum { + /** Static value Classic for SkuName. */ + public static final SkuName CLASSIC = fromString("Classic"); + + /** Static value Basic for SkuName. */ + public static final SkuName BASIC = fromString("Basic"); + + /** Static value Standard for SkuName. */ + public static final SkuName STANDARD = fromString("Standard"); + + /** Static value Premium for SkuName. */ + public static final SkuName PREMIUM = fromString("Premium"); + + /** + * Creates or finds a SkuName from its string representation. + * @param name a name to look for + * @return the corresponding SkuName + */ + @JsonCreator + public static SkuName fromString(String name) { + return fromString(name, SkuName.class); + } + + /** + * @return known SkuName values + */ + public static Collection values() { + return values(SkuName.class); + } +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/SkuTier.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/SkuTier.java new file mode 100644 index 000000000000..33bb08edb714 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/SkuTier.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.containerregistry.v2019_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SkuTier. + */ +public final class SkuTier extends ExpandableStringEnum { + /** Static value Classic for SkuTier. */ + public static final SkuTier CLASSIC = fromString("Classic"); + + /** Static value Basic for SkuTier. */ + public static final SkuTier BASIC = fromString("Basic"); + + /** Static value Standard for SkuTier. */ + public static final SkuTier STANDARD = fromString("Standard"); + + /** Static value Premium for SkuTier. */ + public static final SkuTier PREMIUM = fromString("Premium"); + + /** + * Creates or finds a SkuTier from its string representation. + * @param name a name to look for + * @return the corresponding SkuTier + */ + @JsonCreator + public static SkuTier fromString(String name) { + return fromString(name, SkuTier.class); + } + + /** + * @return known SkuTier values + */ + public static Collection values() { + return values(SkuTier.class); + } +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Source.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Source.java new file mode 100644 index 000000000000..499045cbf58e --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Source.java @@ -0,0 +1,72 @@ +/** + * 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.containerregistry.v2019_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The registry node that generated the event. Put differently, while the actor + * initiates the event, the source generates it. + */ +public class Source { + /** + * The IP or hostname and the port of the registry node that generated the + * event. Generally, this will be resolved by os.Hostname() along with the + * running port. + */ + @JsonProperty(value = "addr") + private String addr; + + /** + * The running instance of an application. Changes after each restart. + */ + @JsonProperty(value = "instanceID") + private String instanceID; + + /** + * Get the IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port. + * + * @return the addr value + */ + public String addr() { + return this.addr; + } + + /** + * Set the IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port. + * + * @param addr the addr value to set + * @return the Source object itself. + */ + public Source withAddr(String addr) { + this.addr = addr; + return this; + } + + /** + * Get the running instance of an application. Changes after each restart. + * + * @return the instanceID value + */ + public String instanceID() { + return this.instanceID; + } + + /** + * Set the running instance of an application. Changes after each restart. + * + * @param instanceID the instanceID value to set + * @return the Source object itself. + */ + public Source withInstanceID(String instanceID) { + this.instanceID = instanceID; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Status.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Status.java new file mode 100644 index 000000000000..7606152abcc6 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Status.java @@ -0,0 +1,64 @@ +/** + * 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.containerregistry.v2019_04_01; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The status of an Azure resource at the time the operation was called. + */ +public class Status { + /** + * The short label for the status. + */ + @JsonProperty(value = "displayStatus", access = JsonProperty.Access.WRITE_ONLY) + private String displayStatus; + + /** + * The detailed message for the status, including alerts and error + * messages. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * The timestamp when the status was changed to the current value. + */ + @JsonProperty(value = "timestamp", access = JsonProperty.Access.WRITE_ONLY) + private DateTime timestamp; + + /** + * Get the short label for the status. + * + * @return the displayStatus value + */ + public String displayStatus() { + return this.displayStatus; + } + + /** + * Get the detailed message for the status, including alerts and error messages. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get the timestamp when the status was changed to the current value. + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/StorageAccountProperties.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/StorageAccountProperties.java new file mode 100644 index 000000000000..67f787f8ce1c --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/StorageAccountProperties.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.containerregistry.v2019_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of a storage account for a container registry. Only + * applicable to Classic SKU. + */ +public class StorageAccountProperties { + /** + * The resource ID of the storage account. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get the resource ID of the storage account. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the resource ID of the storage account. + * + * @param id the id value to set + * @return the StorageAccountProperties object itself. + */ + public StorageAccountProperties withId(String id) { + this.id = id; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Target.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Target.java new file mode 100644 index 000000000000..b1484581472d --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Target.java @@ -0,0 +1,252 @@ +/** + * 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.containerregistry.v2019_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The target of the event. + */ +public class Target { + /** + * The MIME type of the referenced object. + */ + @JsonProperty(value = "mediaType") + private String mediaType; + + /** + * The number of bytes of the content. Same as Length field. + */ + @JsonProperty(value = "size") + private Long size; + + /** + * The digest of the content, as defined by the Registry V2 HTTP API + * Specification. + */ + @JsonProperty(value = "digest") + private String digest; + + /** + * The number of bytes of the content. Same as Size field. + */ + @JsonProperty(value = "length") + private Long length; + + /** + * The repository name. + */ + @JsonProperty(value = "repository") + private String repository; + + /** + * The direct URL to the content. + */ + @JsonProperty(value = "url") + private String url; + + /** + * The tag name. + */ + @JsonProperty(value = "tag") + private String tag; + + /** + * The name of the artifact. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The version of the artifact. + */ + @JsonProperty(value = "version") + private String version; + + /** + * Get the MIME type of the referenced object. + * + * @return the mediaType value + */ + public String mediaType() { + return this.mediaType; + } + + /** + * Set the MIME type of the referenced object. + * + * @param mediaType the mediaType value to set + * @return the Target object itself. + */ + public Target withMediaType(String mediaType) { + this.mediaType = mediaType; + return this; + } + + /** + * Get the number of bytes of the content. Same as Length field. + * + * @return the size value + */ + public Long size() { + return this.size; + } + + /** + * Set the number of bytes of the content. Same as Length field. + * + * @param size the size value to set + * @return the Target object itself. + */ + public Target withSize(Long size) { + this.size = size; + return this; + } + + /** + * Get the digest of the content, as defined by the Registry V2 HTTP API Specification. + * + * @return the digest value + */ + public String digest() { + return this.digest; + } + + /** + * Set the digest of the content, as defined by the Registry V2 HTTP API Specification. + * + * @param digest the digest value to set + * @return the Target object itself. + */ + public Target withDigest(String digest) { + this.digest = digest; + return this; + } + + /** + * Get the number of bytes of the content. Same as Size field. + * + * @return the length value + */ + public Long length() { + return this.length; + } + + /** + * Set the number of bytes of the content. Same as Size field. + * + * @param length the length value to set + * @return the Target object itself. + */ + public Target withLength(Long length) { + this.length = length; + return this; + } + + /** + * Get the repository name. + * + * @return the repository value + */ + public String repository() { + return this.repository; + } + + /** + * Set the repository name. + * + * @param repository the repository value to set + * @return the Target object itself. + */ + public Target withRepository(String repository) { + this.repository = repository; + return this; + } + + /** + * Get the direct URL to the content. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set the direct URL to the content. + * + * @param url the url value to set + * @return the Target object itself. + */ + public Target withUrl(String url) { + this.url = url; + return this; + } + + /** + * Get the tag name. + * + * @return the tag value + */ + public String tag() { + return this.tag; + } + + /** + * Set the tag name. + * + * @param tag the tag value to set + * @return the Target object itself. + */ + public Target withTag(String tag) { + this.tag = tag; + return this; + } + + /** + * Get the name of the artifact. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the artifact. + * + * @param name the name value to set + * @return the Target object itself. + */ + public Target withName(String name) { + this.name = name; + return this; + } + + /** + * Get the version of the artifact. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Set the version of the artifact. + * + * @param version the version value to set + * @return the Target object itself. + */ + public Target withVersion(String version) { + this.version = version; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/TrustPolicy.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/TrustPolicy.java new file mode 100644 index 000000000000..60bde4b91f2c --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/TrustPolicy.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.containerregistry.v2019_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An object that represents content trust policy for a container registry. + */ +public class TrustPolicy { + /** + * The type of trust policy. Possible values include: 'Notary'. + */ + @JsonProperty(value = "type") + private TrustPolicyType type; + + /** + * The value that indicates whether the policy is enabled or not. Possible + * values include: 'enabled', 'disabled'. + */ + @JsonProperty(value = "status") + private PolicyStatus status; + + /** + * Get the type of trust policy. Possible values include: 'Notary'. + * + * @return the type value + */ + public TrustPolicyType type() { + return this.type; + } + + /** + * Set the type of trust policy. Possible values include: 'Notary'. + * + * @param type the type value to set + * @return the TrustPolicy object itself. + */ + public TrustPolicy withType(TrustPolicyType type) { + this.type = type; + return this; + } + + /** + * Get the value that indicates whether the policy is enabled or not. Possible values include: 'enabled', 'disabled'. + * + * @return the status value + */ + public PolicyStatus status() { + return this.status; + } + + /** + * Set the value that indicates whether the policy is enabled or not. Possible values include: 'enabled', 'disabled'. + * + * @param status the status value to set + * @return the TrustPolicy object itself. + */ + public TrustPolicy withStatus(PolicyStatus status) { + this.status = status; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/TrustPolicyType.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/TrustPolicyType.java new file mode 100644 index 000000000000..75bd18da8b91 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/TrustPolicyType.java @@ -0,0 +1,38 @@ +/** + * 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.containerregistry.v2019_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for TrustPolicyType. + */ +public final class TrustPolicyType extends ExpandableStringEnum { + /** Static value Notary for TrustPolicyType. */ + public static final TrustPolicyType NOTARY = fromString("Notary"); + + /** + * Creates or finds a TrustPolicyType from its string representation. + * @param name a name to look for + * @return the corresponding TrustPolicyType + */ + @JsonCreator + public static TrustPolicyType fromString(String name) { + return fromString(name, TrustPolicyType.class); + } + + /** + * @return known TrustPolicyType values + */ + public static Collection values() { + return values(TrustPolicyType.class); + } +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/VirtualNetworkRule.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/VirtualNetworkRule.java new file mode 100644 index 000000000000..b965167b06e0 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/VirtualNetworkRule.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.containerregistry.v2019_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Virtual network rule. + */ +public class VirtualNetworkRule { + /** + * The action of virtual network rule. Possible values include: 'Allow'. + */ + @JsonProperty(value = "action") + private Action action; + + /** + * Resource ID of a subnet, for example: + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + */ + @JsonProperty(value = "id", required = true) + private String virtualNetworkResourceId; + + /** + * Get the action of virtual network rule. Possible values include: 'Allow'. + * + * @return the action value + */ + public Action action() { + return this.action; + } + + /** + * Set the action of virtual network rule. Possible values include: 'Allow'. + * + * @param action the action value to set + * @return the VirtualNetworkRule object itself. + */ + public VirtualNetworkRule withAction(Action action) { + this.action = action; + return this; + } + + /** + * Get resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + * + * @return the virtualNetworkResourceId value + */ + public String virtualNetworkResourceId() { + return this.virtualNetworkResourceId; + } + + /** + * Set resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + * + * @param virtualNetworkResourceId the virtualNetworkResourceId value to set + * @return the VirtualNetworkRule object itself. + */ + public VirtualNetworkRule withVirtualNetworkResourceId(String virtualNetworkResourceId) { + this.virtualNetworkResourceId = virtualNetworkResourceId; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Webhook.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Webhook.java new file mode 100644 index 000000000000..14ee1eae4f7c --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Webhook.java @@ -0,0 +1,276 @@ +/** + * 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.containerregistry.v2019_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.containerregistry.v2019_04_01.implementation.WebhookInner; +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.containerregistry.v2019_04_01.implementation.ContainerRegistryManager; +import java.util.Map; +import java.util.List; + +/** + * Type representing Webhook. + */ +public interface Webhook extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the actions value. + */ + List actions(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * @return the scope value. + */ + String scope(); + + /** + * @return the status value. + */ + WebhookStatus status(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the Webhook definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithRegistry, DefinitionStages.WithActions, DefinitionStages.WithLocation, DefinitionStages.WithServiceUri, DefinitionStages.WithCreate { + } + + /** + * Grouping of Webhook definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Webhook definition. + */ + interface Blank extends WithRegistry { + } + + /** + * The stage of the webhook definition allowing to specify Registry. + */ + interface WithRegistry { + /** + * Specifies resourceGroupName, registryName. + * @param resourceGroupName The name of the resource group to which the container registry belongs + * @param registryName The name of the container registry + * @return the next definition stage + */ + WithActions withExistingRegistry(String resourceGroupName, String registryName); + } + + /** + * The stage of the webhook definition allowing to specify Actions. + */ + interface WithActions { + /** + * Specifies actions. + * @param actions The list of actions that trigger the webhook to post notifications + * @return the next definition stage + */ + WithLocation withActions(List actions); + } + + /** + * The stage of the webhook definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the webhook. This cannot be changed after the resource is created + * @return the next definition stage + */ + WithServiceUri withLocation(String location); + } + + /** + * The stage of the webhook definition allowing to specify ServiceUri. + */ + interface WithServiceUri { + /** + * Specifies serviceUri. + * @param serviceUri The service URI for the webhook to post notifications + * @return the next definition stage + */ + WithCreate withServiceUri(String serviceUri); + } + + /** + * The stage of the webhook definition allowing to specify CustomHeaders. + */ + interface WithCustomHeaders { + /** + * Specifies customHeaders. + * @param customHeaders Custom headers that will be added to the webhook notifications + * @return the next definition stage + */ + WithCreate withCustomHeaders(Map customHeaders); + } + + /** + * The stage of the webhook definition allowing to specify Scope. + */ + interface WithScope { + /** + * Specifies scope. + * @param scope The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events + * @return the next definition stage + */ + WithCreate withScope(String scope); + } + + /** + * The stage of the webhook definition allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status The status of the webhook at the time the operation was called. Possible values include: 'enabled', 'disabled' + * @return the next definition stage + */ + WithCreate withStatus(WebhookStatus status); + } + + /** + * The stage of the webhook definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags for the webhook + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * 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.WithCustomHeaders, DefinitionStages.WithScope, DefinitionStages.WithStatus, DefinitionStages.WithTags { + } + } + /** + * The template for a Webhook update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithActions, UpdateStages.WithCustomHeaders, UpdateStages.WithScope, UpdateStages.WithServiceUri, UpdateStages.WithStatus, UpdateStages.WithTags { + } + + /** + * Grouping of Webhook update stages. + */ + interface UpdateStages { + /** + * The stage of the webhook update allowing to specify Actions. + */ + interface WithActions { + /** + * Specifies actions. + * @param actions The list of actions that trigger the webhook to post notifications + * @return the next update stage + */ + Update withActions(List actions); + } + + /** + * The stage of the webhook update allowing to specify CustomHeaders. + */ + interface WithCustomHeaders { + /** + * Specifies customHeaders. + * @param customHeaders Custom headers that will be added to the webhook notifications + * @return the next update stage + */ + Update withCustomHeaders(Map customHeaders); + } + + /** + * The stage of the webhook update allowing to specify Scope. + */ + interface WithScope { + /** + * Specifies scope. + * @param scope The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events + * @return the next update stage + */ + Update withScope(String scope); + } + + /** + * The stage of the webhook update allowing to specify ServiceUri. + */ + interface WithServiceUri { + /** + * Specifies serviceUri. + * @param serviceUri The service URI for the webhook to post notifications + * @return the next update stage + */ + Update withServiceUri(String serviceUri); + } + + /** + * The stage of the webhook update allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status The status of the webhook at the time the operation was called. Possible values include: 'enabled', 'disabled' + * @return the next update stage + */ + Update withStatus(WebhookStatus status); + } + + /** + * The stage of the webhook update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags for the webhook + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/WebhookAction.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/WebhookAction.java new file mode 100644 index 000000000000..2ed61d9ab29f --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/WebhookAction.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.containerregistry.v2019_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for WebhookAction. + */ +public final class WebhookAction extends ExpandableStringEnum { + /** Static value push for WebhookAction. */ + public static final WebhookAction PUSH = fromString("push"); + + /** Static value delete for WebhookAction. */ + public static final WebhookAction DELETE = fromString("delete"); + + /** Static value quarantine for WebhookAction. */ + public static final WebhookAction QUARANTINE = fromString("quarantine"); + + /** Static value chart_push for WebhookAction. */ + public static final WebhookAction CHART_PUSH = fromString("chart_push"); + + /** Static value chart_delete for WebhookAction. */ + public static final WebhookAction CHART_DELETE = fromString("chart_delete"); + + /** + * Creates or finds a WebhookAction from its string representation. + * @param name a name to look for + * @return the corresponding WebhookAction + */ + @JsonCreator + public static WebhookAction fromString(String name) { + return fromString(name, WebhookAction.class); + } + + /** + * @return known WebhookAction values + */ + public static Collection values() { + return values(WebhookAction.class); + } +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/WebhookCreateParameters.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/WebhookCreateParameters.java new file mode 100644 index 000000000000..f787a1216142 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/WebhookCreateParameters.java @@ -0,0 +1,208 @@ +/** + * 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.containerregistry.v2019_04_01; + +import java.util.Map; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The parameters for creating a webhook. + */ +@JsonFlatten +public class WebhookCreateParameters { + /** + * The tags for the webhook. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * The location of the webhook. This cannot be changed after the resource + * is created. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * The service URI for the webhook to post notifications. + */ + @JsonProperty(value = "properties.serviceUri", required = true) + private String serviceUri; + + /** + * Custom headers that will be added to the webhook notifications. + */ + @JsonProperty(value = "properties.customHeaders") + private Map customHeaders; + + /** + * The status of the webhook at the time the operation was called. Possible + * values include: 'enabled', 'disabled'. + */ + @JsonProperty(value = "properties.status") + private WebhookStatus status; + + /** + * The scope of repositories where the event can be triggered. For example, + * 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' + * means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. + * Empty means all events. + */ + @JsonProperty(value = "properties.scope") + private String scope; + + /** + * The list of actions that trigger the webhook to post notifications. + */ + @JsonProperty(value = "properties.actions", required = true) + private List actions; + + /** + * Get the tags for the webhook. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags for the webhook. + * + * @param tags the tags value to set + * @return the WebhookCreateParameters object itself. + */ + public WebhookCreateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the location of the webhook. This cannot be changed after the resource is created. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location of the webhook. This cannot be changed after the resource is created. + * + * @param location the location value to set + * @return the WebhookCreateParameters object itself. + */ + public WebhookCreateParameters withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the service URI for the webhook to post notifications. + * + * @return the serviceUri value + */ + public String serviceUri() { + return this.serviceUri; + } + + /** + * Set the service URI for the webhook to post notifications. + * + * @param serviceUri the serviceUri value to set + * @return the WebhookCreateParameters object itself. + */ + public WebhookCreateParameters withServiceUri(String serviceUri) { + this.serviceUri = serviceUri; + return this; + } + + /** + * Get custom headers that will be added to the webhook notifications. + * + * @return the customHeaders value + */ + public Map customHeaders() { + return this.customHeaders; + } + + /** + * Set custom headers that will be added to the webhook notifications. + * + * @param customHeaders the customHeaders value to set + * @return the WebhookCreateParameters object itself. + */ + public WebhookCreateParameters withCustomHeaders(Map customHeaders) { + this.customHeaders = customHeaders; + return this; + } + + /** + * Get the status of the webhook at the time the operation was called. Possible values include: 'enabled', 'disabled'. + * + * @return the status value + */ + public WebhookStatus status() { + return this.status; + } + + /** + * Set the status of the webhook at the time the operation was called. Possible values include: 'enabled', 'disabled'. + * + * @param status the status value to set + * @return the WebhookCreateParameters object itself. + */ + public WebhookCreateParameters withStatus(WebhookStatus status) { + this.status = status; + return this; + } + + /** + * Get the scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @return the scope value + */ + public String scope() { + return this.scope; + } + + /** + * Set the scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @param scope the scope value to set + * @return the WebhookCreateParameters object itself. + */ + public WebhookCreateParameters withScope(String scope) { + this.scope = scope; + return this; + } + + /** + * Get the list of actions that trigger the webhook to post notifications. + * + * @return the actions value + */ + public List actions() { + return this.actions; + } + + /** + * Set the list of actions that trigger the webhook to post notifications. + * + * @param actions the actions value to set + * @return the WebhookCreateParameters object itself. + */ + public WebhookCreateParameters withActions(List actions) { + this.actions = actions; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/WebhookStatus.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/WebhookStatus.java new file mode 100644 index 000000000000..0e9b06779043 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/WebhookStatus.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.containerregistry.v2019_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for WebhookStatus. + */ +public final class WebhookStatus extends ExpandableStringEnum { + /** Static value enabled for WebhookStatus. */ + public static final WebhookStatus ENABLED = fromString("enabled"); + + /** Static value disabled for WebhookStatus. */ + public static final WebhookStatus DISABLED = fromString("disabled"); + + /** + * Creates or finds a WebhookStatus from its string representation. + * @param name a name to look for + * @return the corresponding WebhookStatus + */ + @JsonCreator + public static WebhookStatus fromString(String name) { + return fromString(name, WebhookStatus.class); + } + + /** + * @return known WebhookStatus values + */ + public static Collection values() { + return values(WebhookStatus.class); + } +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/WebhookUpdateParameters.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/WebhookUpdateParameters.java new file mode 100644 index 000000000000..be8582b9a48f --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/WebhookUpdateParameters.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.containerregistry.v2019_04_01; + +import java.util.Map; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The parameters for updating a webhook. + */ +@JsonFlatten +public class WebhookUpdateParameters { + /** + * The tags for the webhook. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * The service URI for the webhook to post notifications. + */ + @JsonProperty(value = "properties.serviceUri") + private String serviceUri; + + /** + * Custom headers that will be added to the webhook notifications. + */ + @JsonProperty(value = "properties.customHeaders") + private Map customHeaders; + + /** + * The status of the webhook at the time the operation was called. Possible + * values include: 'enabled', 'disabled'. + */ + @JsonProperty(value = "properties.status") + private WebhookStatus status; + + /** + * The scope of repositories where the event can be triggered. For example, + * 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' + * means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. + * Empty means all events. + */ + @JsonProperty(value = "properties.scope") + private String scope; + + /** + * The list of actions that trigger the webhook to post notifications. + */ + @JsonProperty(value = "properties.actions") + private List actions; + + /** + * Get the tags for the webhook. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags for the webhook. + * + * @param tags the tags value to set + * @return the WebhookUpdateParameters object itself. + */ + public WebhookUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the service URI for the webhook to post notifications. + * + * @return the serviceUri value + */ + public String serviceUri() { + return this.serviceUri; + } + + /** + * Set the service URI for the webhook to post notifications. + * + * @param serviceUri the serviceUri value to set + * @return the WebhookUpdateParameters object itself. + */ + public WebhookUpdateParameters withServiceUri(String serviceUri) { + this.serviceUri = serviceUri; + return this; + } + + /** + * Get custom headers that will be added to the webhook notifications. + * + * @return the customHeaders value + */ + public Map customHeaders() { + return this.customHeaders; + } + + /** + * Set custom headers that will be added to the webhook notifications. + * + * @param customHeaders the customHeaders value to set + * @return the WebhookUpdateParameters object itself. + */ + public WebhookUpdateParameters withCustomHeaders(Map customHeaders) { + this.customHeaders = customHeaders; + return this; + } + + /** + * Get the status of the webhook at the time the operation was called. Possible values include: 'enabled', 'disabled'. + * + * @return the status value + */ + public WebhookStatus status() { + return this.status; + } + + /** + * Set the status of the webhook at the time the operation was called. Possible values include: 'enabled', 'disabled'. + * + * @param status the status value to set + * @return the WebhookUpdateParameters object itself. + */ + public WebhookUpdateParameters withStatus(WebhookStatus status) { + this.status = status; + return this; + } + + /** + * Get the scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @return the scope value + */ + public String scope() { + return this.scope; + } + + /** + * Set the scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @param scope the scope value to set + * @return the WebhookUpdateParameters object itself. + */ + public WebhookUpdateParameters withScope(String scope) { + this.scope = scope; + return this; + } + + /** + * Get the list of actions that trigger the webhook to post notifications. + * + * @return the actions value + */ + public List actions() { + return this.actions; + } + + /** + * Set the list of actions that trigger the webhook to post notifications. + * + * @param actions the actions value to set + * @return the WebhookUpdateParameters object itself. + */ + public WebhookUpdateParameters withActions(List actions) { + this.actions = actions; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Webhooks.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Webhooks.java new file mode 100644 index 000000000000..2bb62b1862f6 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/Webhooks.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.containerregistry.v2019_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.containerregistry.v2019_04_01.implementation.WebhooksInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Webhooks. + */ +public interface Webhooks extends SupportsCreating, HasInner { + /** + * Triggers a ping event to be sent to the webhook. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable pingAsync(String resourceGroupName, String registryName, String webhookName); + + /** + * Gets the configuration of service URI and custom headers for the webhook. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getCallbackConfigAsync(String resourceGroupName, String registryName, String webhookName); + + /** + * Lists recent events for the specified webhook. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listEventsAsync(final String resourceGroupName, final String registryName, final String webhookName); + + /** + * Gets the properties of the specified webhook. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String registryName, String webhookName); + + /** + * Lists all the webhooks for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String registryName); + + /** + * Deletes a webhook from a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String registryName, String webhookName); + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/CallbackConfigImpl.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/CallbackConfigImpl.java new file mode 100644 index 000000000000..1c6859b04d00 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/CallbackConfigImpl.java @@ -0,0 +1,37 @@ +/** + * 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.containerregistry.v2019_04_01.implementation; + +import com.microsoft.azure.management.containerregistry.v2019_04_01.CallbackConfig; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.Map; + +class CallbackConfigImpl extends WrapperImpl implements CallbackConfig { + private final ContainerRegistryManager manager; + CallbackConfigImpl(CallbackConfigInner inner, ContainerRegistryManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ContainerRegistryManager manager() { + return this.manager; + } + + @Override + public Map customHeaders() { + return this.inner().customHeaders(); + } + + @Override + public String serviceUri() { + return this.inner().serviceUri(); + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/CallbackConfigInner.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/CallbackConfigInner.java new file mode 100644 index 000000000000..05579d0cd269 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/CallbackConfigInner.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.containerregistry.v2019_04_01.implementation; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The configuration of service URI and custom headers for the webhook. + */ +public class CallbackConfigInner { + /** + * The service URI for the webhook to post notifications. + */ + @JsonProperty(value = "serviceUri", required = true) + private String serviceUri; + + /** + * Custom headers that will be added to the webhook notifications. + */ + @JsonProperty(value = "customHeaders") + private Map customHeaders; + + /** + * Get the service URI for the webhook to post notifications. + * + * @return the serviceUri value + */ + public String serviceUri() { + return this.serviceUri; + } + + /** + * Set the service URI for the webhook to post notifications. + * + * @param serviceUri the serviceUri value to set + * @return the CallbackConfigInner object itself. + */ + public CallbackConfigInner withServiceUri(String serviceUri) { + this.serviceUri = serviceUri; + return this; + } + + /** + * Get custom headers that will be added to the webhook notifications. + * + * @return the customHeaders value + */ + public Map customHeaders() { + return this.customHeaders; + } + + /** + * Set custom headers that will be added to the webhook notifications. + * + * @param customHeaders the customHeaders value to set + * @return the CallbackConfigInner object itself. + */ + public CallbackConfigInner withCustomHeaders(Map customHeaders) { + this.customHeaders = customHeaders; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/ContainerRegistryManagementClientImpl.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/ContainerRegistryManagementClientImpl.java index 6fc219c6813e..76d7ade0e46d 100644 --- a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/ContainerRegistryManagementClientImpl.java +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/ContainerRegistryManagementClientImpl.java @@ -51,18 +51,6 @@ public ContainerRegistryManagementClientImpl withSubscriptionId(String subscript 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; @@ -145,6 +133,45 @@ public RegistriesInner registries() { return this.registries; } + /** + * 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 ReplicationsInner object to access its operations. + */ + private ReplicationsInner replications; + + /** + * Gets the ReplicationsInner object to access its operations. + * @return the ReplicationsInner object. + */ + public ReplicationsInner replications() { + return this.replications; + } + + /** + * The WebhooksInner object to access its operations. + */ + private WebhooksInner webhooks; + + /** + * Gets the WebhooksInner object to access its operations. + * @return the WebhooksInner object. + */ + public WebhooksInner webhooks() { + return this.webhooks; + } + /** * The RunsInner object to access its operations. */ @@ -202,11 +229,13 @@ public ContainerRegistryManagementClientImpl(RestClient restClient) { } protected void initialize() { - this.apiVersion = "2019-04-01"; this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; this.registries = new RegistriesInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.replications = new ReplicationsInner(restClient().retrofit(), this); + this.webhooks = new WebhooksInner(restClient().retrofit(), this); this.runs = new RunsInner(restClient().retrofit(), this); this.tasks = new TasksInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/ContainerRegistryManager.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/ContainerRegistryManager.java index 5bcca6b73922..6c864c265983 100644 --- a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/ContainerRegistryManager.java +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/ContainerRegistryManager.java @@ -17,6 +17,9 @@ import com.microsoft.azure.serializer.AzureJacksonAdapter; import com.microsoft.rest.RestClient; import com.microsoft.azure.management.containerregistry.v2019_04_01.Registries; +import com.microsoft.azure.management.containerregistry.v2019_04_01.Operations; +import com.microsoft.azure.management.containerregistry.v2019_04_01.Replications; +import com.microsoft.azure.management.containerregistry.v2019_04_01.Webhooks; import com.microsoft.azure.management.containerregistry.v2019_04_01.Runs; import com.microsoft.azure.management.containerregistry.v2019_04_01.Tasks; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; @@ -27,6 +30,9 @@ */ public final class ContainerRegistryManager extends ManagerCore { private Registries registries; + private Operations operations; + private Replications replications; + private Webhooks webhooks; private Runs runs; private Tasks tasks; /** @@ -86,6 +92,36 @@ public Registries registries() { return this.registries; } + /** + * @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 Replications. + */ + public Replications replications() { + if (this.replications == null) { + this.replications = new ReplicationsImpl(this); + } + return this.replications; + } + + /** + * @return Entry point to manage Webhooks. + */ + public Webhooks webhooks() { + if (this.webhooks == null) { + this.webhooks = new WebhooksImpl(this); + } + return this.webhooks; + } + /** * @return Entry point to manage Runs. */ diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/EventImpl.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/EventImpl.java new file mode 100644 index 000000000000..ccca9e2f85ba --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/EventImpl.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.containerregistry.v2019_04_01.implementation; + +import com.microsoft.azure.management.containerregistry.v2019_04_01.Event; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.containerregistry.v2019_04_01.EventRequestMessage; +import com.microsoft.azure.management.containerregistry.v2019_04_01.EventResponseMessage; + +class EventImpl extends WrapperImpl implements Event { + private final ContainerRegistryManager manager; + EventImpl(EventInner inner, ContainerRegistryManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ContainerRegistryManager manager() { + return this.manager; + } + + @Override + public EventRequestMessage eventRequestMessage() { + return this.inner().eventRequestMessage(); + } + + @Override + public EventResponseMessage eventResponseMessage() { + return this.inner().eventResponseMessage(); + } + + @Override + public String id() { + return this.inner().id(); + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/EventInfoImpl.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/EventInfoImpl.java new file mode 100644 index 000000000000..cbb60119a308 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/EventInfoImpl.java @@ -0,0 +1,31 @@ +/** + * 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.containerregistry.v2019_04_01.implementation; + +import com.microsoft.azure.management.containerregistry.v2019_04_01.EventInfo; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class EventInfoImpl extends WrapperImpl implements EventInfo { + private final ContainerRegistryManager manager; + EventInfoImpl(EventInfoInner inner, ContainerRegistryManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ContainerRegistryManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/EventInfoInner.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/EventInfoInner.java new file mode 100644 index 000000000000..fcdaa58e348d --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/EventInfoInner.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.containerregistry.v2019_04_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The basic information of an event. + */ +public class EventInfoInner { + /** + * The event ID. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the event ID. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the event ID. + * + * @param id the id value to set + * @return the EventInfoInner object itself. + */ + public EventInfoInner withId(String id) { + this.id = id; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/EventInner.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/EventInner.java new file mode 100644 index 000000000000..b31a06857a7c --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/EventInner.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.containerregistry.v2019_04_01.implementation; + +import com.microsoft.azure.management.containerregistry.v2019_04_01.EventRequestMessage; +import com.microsoft.azure.management.containerregistry.v2019_04_01.EventResponseMessage; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The event for a webhook. + */ +public class EventInner extends EventInfoInner { + /** + * The event request message sent to the service URI. + */ + @JsonProperty(value = "eventRequestMessage") + private EventRequestMessage eventRequestMessage; + + /** + * The event response message received from the service URI. + */ + @JsonProperty(value = "eventResponseMessage") + private EventResponseMessage eventResponseMessage; + + /** + * Get the event request message sent to the service URI. + * + * @return the eventRequestMessage value + */ + public EventRequestMessage eventRequestMessage() { + return this.eventRequestMessage; + } + + /** + * Set the event request message sent to the service URI. + * + * @param eventRequestMessage the eventRequestMessage value to set + * @return the EventInner object itself. + */ + public EventInner withEventRequestMessage(EventRequestMessage eventRequestMessage) { + this.eventRequestMessage = eventRequestMessage; + return this; + } + + /** + * Get the event response message received from the service URI. + * + * @return the eventResponseMessage value + */ + public EventResponseMessage eventResponseMessage() { + return this.eventResponseMessage; + } + + /** + * Set the event response message received from the service URI. + * + * @param eventResponseMessage the eventResponseMessage value to set + * @return the EventInner object itself. + */ + public EventInner withEventResponseMessage(EventResponseMessage eventResponseMessage) { + this.eventResponseMessage = eventResponseMessage; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/OperationDefinitionImpl.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/OperationDefinitionImpl.java new file mode 100644 index 000000000000..1a966313688f --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/OperationDefinitionImpl.java @@ -0,0 +1,48 @@ +/** + * 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.containerregistry.v2019_04_01.implementation; + +import com.microsoft.azure.management.containerregistry.v2019_04_01.OperationDefinition; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.containerregistry.v2019_04_01.OperationDisplayDefinition; +import com.microsoft.azure.management.containerregistry.v2019_04_01.OperationServiceSpecificationDefinition; + +class OperationDefinitionImpl extends WrapperImpl implements OperationDefinition { + private final ContainerRegistryManager manager; + OperationDefinitionImpl(OperationDefinitionInner inner, ContainerRegistryManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ContainerRegistryManager manager() { + return this.manager; + } + + @Override + public OperationDisplayDefinition display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String origin() { + return this.inner().origin(); + } + + @Override + public OperationServiceSpecificationDefinition serviceSpecification() { + return this.inner().serviceSpecification(); + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/OperationDefinitionInner.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/OperationDefinitionInner.java new file mode 100644 index 000000000000..513fc728b21c --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/OperationDefinitionInner.java @@ -0,0 +1,125 @@ +/** + * 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.containerregistry.v2019_04_01.implementation; + +import com.microsoft.azure.management.containerregistry.v2019_04_01.OperationDisplayDefinition; +import com.microsoft.azure.management.containerregistry.v2019_04_01.OperationServiceSpecificationDefinition; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The definition of a container registry operation. + */ +@JsonFlatten +public class OperationDefinitionInner { + /** + * The origin information of the container registry operation. + */ + @JsonProperty(value = "origin") + private String origin; + + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The display information for the container registry operation. + */ + @JsonProperty(value = "display") + private OperationDisplayDefinition display; + + /** + * The definition of Azure Monitoring service. + */ + @JsonProperty(value = "properties.serviceSpecification") + private OperationServiceSpecificationDefinition serviceSpecification; + + /** + * Get the origin information of the container registry operation. + * + * @return the origin value + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin information of the container registry operation. + * + * @param origin the origin value to set + * @return the OperationDefinitionInner object itself. + */ + public OperationDefinitionInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the OperationDefinitionInner object itself. + */ + public OperationDefinitionInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display information for the container registry operation. + * + * @return the display value + */ + public OperationDisplayDefinition display() { + return this.display; + } + + /** + * Set the display information for the container registry operation. + * + * @param display the display value to set + * @return the OperationDefinitionInner object itself. + */ + public OperationDefinitionInner withDisplay(OperationDisplayDefinition display) { + this.display = display; + return this; + } + + /** + * Get the definition of Azure Monitoring service. + * + * @return the serviceSpecification value + */ + public OperationServiceSpecificationDefinition serviceSpecification() { + return this.serviceSpecification; + } + + /** + * Set the definition of Azure Monitoring service. + * + * @param serviceSpecification the serviceSpecification value to set + * @return the OperationDefinitionInner object itself. + */ + public OperationDefinitionInner withServiceSpecification(OperationServiceSpecificationDefinition serviceSpecification) { + this.serviceSpecification = serviceSpecification; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/OperationsImpl.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/OperationsImpl.java new file mode 100644 index 000000000000..590899b75546 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_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.containerregistry.v2019_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.containerregistry.v2019_04_01.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.containerregistry.v2019_04_01.OperationDefinition; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ContainerRegistryManager manager; + + OperationsImpl(ContainerRegistryManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ContainerRegistryManager 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 OperationDefinition call(OperationDefinitionInner inner) { + return new OperationDefinitionImpl(inner, manager()); + } + }); + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/OperationsInner.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/OperationsInner.java new file mode 100644 index 000000000000..f1b3dd3fb3d2 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/OperationsInner.java @@ -0,0 +1,281 @@ +/** + * 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.containerregistry.v2019_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +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 ContainerRegistryManagementClientImpl 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, ContainerRegistryManagementClientImpl 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.containerregistry.v2019_04_01.Operations list" }) + @GET("providers/Microsoft.ContainerRegistry/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.containerregistry.v2019_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 Azure Container Registry REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<OperationDefinitionInner> 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 Azure Container Registry REST API operations. + * + * @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 Azure Container Registry REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationDefinitionInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Azure Container Registry REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationDefinitionInner> 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 Azure Container Registry REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + final String apiVersion = "2017-10-01"; + return service.list(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 CloudException, IOException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all of the available Azure Container Registry REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<OperationDefinitionInner> 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 Azure Container Registry REST API operations. + * + * @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 Azure Container Registry REST API operations. + * + * @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<OperationDefinitionInner> 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 Azure Container Registry REST API operations. + * + * @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<OperationDefinitionInner> 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 Azure Container Registry REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationDefinitionInner> 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistriesImpl.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistriesImpl.java index 19480780e419..439ab7cc8498 100644 --- a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistriesImpl.java +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistriesImpl.java @@ -4,29 +4,176 @@ * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. - * abc + * def */ package com.microsoft.azure.management.containerregistry.v2019_04_01.implementation; -import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; import com.microsoft.azure.management.containerregistry.v2019_04_01.Registries; -import rx.functions.Func1; +import com.microsoft.azure.management.containerregistry.v2019_04_01.Registry; 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; +import com.microsoft.azure.management.containerregistry.v2019_04_01.RegistryListCredentialsResult; +import com.microsoft.azure.management.containerregistry.v2019_04_01.RegistryPolicies; import com.microsoft.azure.management.containerregistry.v2019_04_01.Run; import com.microsoft.azure.management.containerregistry.v2019_04_01.SourceUploadDefinition; +import com.microsoft.azure.management.containerregistry.v2019_04_01.RegistryNameStatus; +import com.microsoft.azure.management.containerregistry.v2019_04_01.ImportImageParameters; +import com.microsoft.azure.management.containerregistry.v2019_04_01.PasswordName; import com.microsoft.azure.management.containerregistry.v2019_04_01.RunRequest; +import com.microsoft.azure.management.containerregistry.v2019_04_01.RegistryUsageListResult; + +class RegistriesImpl extends GroupableResourcesCoreImpl implements Registries { + protected RegistriesImpl(ContainerRegistryManager manager) { + super(manager.inner().registries(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + RegistriesInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + RegistriesInner 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) { + RegistriesInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + RegistriesInner 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 Registry call(RegistryInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + RegistriesInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + RegistriesInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Registry call(RegistryInner inner) { + return wrapModel(inner); + } + }); + } -class RegistriesImpl extends WrapperImpl implements Registries { - private final ContainerRegistryManager manager; + @Override + public RegistryImpl define(String name) { + return wrapModel(name); + } - RegistriesImpl(ContainerRegistryManager manager) { - super(manager.inner().registries()); - this.manager = manager; + @Override + public Completable importImageAsync(String resourceGroupName, String registryName, ImportImageParameters parameters) { + RegistriesInner client = this.inner(); + return client.importImageAsync(resourceGroupName, registryName, parameters).toCompletable(); } - public ContainerRegistryManager manager() { - return this.manager; + @Override + public Observable listCredentialsAsync(String resourceGroupName, String registryName) { + RegistriesInner client = this.inner(); + return client.listCredentialsAsync(resourceGroupName, registryName) + .map(new Func1() { + @Override + public RegistryListCredentialsResult call(RegistryListCredentialsResultInner inner) { + return new RegistryListCredentialsResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable regenerateCredentialAsync(String resourceGroupName, String registryName, PasswordName name) { + RegistriesInner client = this.inner(); + return client.regenerateCredentialAsync(resourceGroupName, registryName, name) + .map(new Func1() { + @Override + public RegistryListCredentialsResult call(RegistryListCredentialsResultInner inner) { + return new RegistryListCredentialsResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable updatePoliciesAsync(String resourceGroupName, String registryName, RegistryPoliciesInner registryPoliciesUpdateParameters) { + RegistriesInner client = this.inner(); + return client.updatePoliciesAsync(resourceGroupName, registryName, registryPoliciesUpdateParameters) + .map(new Func1() { + @Override + public RegistryPolicies call(RegistryPoliciesInner inner) { + return new RegistryPoliciesImpl(inner, manager()); + } + }); } @Override @@ -53,4 +200,50 @@ public SourceUploadDefinition call(SourceUploadDefinitionInner inner) { }); } + @Override + public Observable checkNameAvailabilityAsync(String name) { + RegistriesInner client = this.inner(); + return client.checkNameAvailabilityAsync(name) + .map(new Func1() { + @Override + public RegistryNameStatus call(RegistryNameStatusInner inner) { + return new RegistryNameStatusImpl(inner, manager()); + } + }); + } + + @Override + protected RegistryImpl wrapModel(RegistryInner inner) { + return new RegistryImpl(inner.name(), inner, manager()); + } + + @Override + protected RegistryImpl wrapModel(String name) { + return new RegistryImpl(name, new RegistryInner(), this.manager()); + } + + @Override + public Observable listUsagesAsync(String resourceGroupName, String registryName) { + RegistriesInner client = this.inner(); + return client.listUsagesAsync(resourceGroupName, registryName) + .map(new Func1() { + @Override + public RegistryUsageListResult call(RegistryUsageListResultInner inner) { + return new RegistryUsageListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listPoliciesAsync(String resourceGroupName, String registryName) { + RegistriesInner client = this.inner(); + return client.listPoliciesAsync(resourceGroupName, registryName) + .map(new Func1() { + @Override + public RegistryPolicies call(RegistryPoliciesInner inner) { + return new RegistryPoliciesImpl(inner, manager()); + } + }); + } + } diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistriesInner.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistriesInner.java index b36e67139a88..62e98ef16d40 100644 --- a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistriesInner.java +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistriesInner.java @@ -8,22 +8,40 @@ package com.microsoft.azure.management.containerregistry.v2019_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.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.containerregistry.v2019_04_01.ImportImageParameters; +import com.microsoft.azure.management.containerregistry.v2019_04_01.PasswordName; +import com.microsoft.azure.management.containerregistry.v2019_04_01.RegenerateCredentialParameters; +import com.microsoft.azure.management.containerregistry.v2019_04_01.RegistryNameCheckRequest; +import com.microsoft.azure.management.containerregistry.v2019_04_01.RegistryUpdateParameters; import com.microsoft.azure.management.containerregistry.v2019_04_01.RunRequest; +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.PATCH; import retrofit2.http.Path; import retrofit2.http.POST; +import retrofit2.http.PUT; import retrofit2.http.Query; +import retrofit2.http.Url; import retrofit2.Response; import rx.functions.Func1; import rx.Observable; @@ -32,7 +50,7 @@ * An instance of this class provides access to all the operations defined * in Registries. */ -public class RegistriesInner { +public class RegistriesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { /** The Retrofit service to perform REST calls. */ private RegistriesService service; /** The service client containing this operation class. */ @@ -54,18 +72,1645 @@ public RegistriesInner(Retrofit retrofit, ContainerRegistryManagementClientImpl * used by Retrofit to perform actually REST calls. */ interface RegistriesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerregistry.v2019_04_01.Registries importImage" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage") + Observable> importImage(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Query("api-version") String apiVersion, @Body ImportImageParameters parameters, @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.containerregistry.v2019_04_01.Registries beginImportImage" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importImage") + Observable> beginImportImage(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Query("api-version") String apiVersion, @Body ImportImageParameters parameters, @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.containerregistry.v2019_04_01.Registries checkNameAvailability" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability") + Observable> checkNameAvailability(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body RegistryNameCheckRequest registryNameCheckRequest, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerregistry.v2019_04_01.Registries getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @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.containerregistry.v2019_04_01.Registries create" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}") + Observable> create(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Query("api-version") String apiVersion, @Body RegistryInner registry, @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.containerregistry.v2019_04_01.Registries beginCreate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}") + Observable> beginCreate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Query("api-version") String apiVersion, @Body RegistryInner registry, @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.containerregistry.v2019_04_01.Registries delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @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.containerregistry.v2019_04_01.Registries beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @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.containerregistry.v2019_04_01.Registries update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Query("api-version") String apiVersion, @Body RegistryUpdateParameters registryUpdateParameters, @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.containerregistry.v2019_04_01.Registries beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}") + Observable> beginUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Query("api-version") String apiVersion, @Body RegistryUpdateParameters registryUpdateParameters, @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.containerregistry.v2019_04_01.Registries listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries") + Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @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.containerregistry.v2019_04_01.Registries list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries") + 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.containerregistry.v2019_04_01.Registries listCredentials" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials") + Observable> listCredentials(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @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.containerregistry.v2019_04_01.Registries regenerateCredential" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential") + Observable> regenerateCredential(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body RegenerateCredentialParameters regenerateCredentialParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerregistry.v2019_04_01.Registries listUsages" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listUsages") + Observable> listUsages(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @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.containerregistry.v2019_04_01.Registries listPolicies" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listPolicies") + Observable> listPolicies(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @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.containerregistry.v2019_04_01.Registries updatePolicies" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/updatePolicies") + Observable> updatePolicies(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Query("api-version") String apiVersion, @Body RegistryPoliciesInner registryPoliciesUpdateParameters, @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.containerregistry.v2019_04_01.Registries beginUpdatePolicies" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/updatePolicies") + Observable> beginUpdatePolicies(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Query("api-version") String apiVersion, @Body RegistryPoliciesInner registryPoliciesUpdateParameters, @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.containerregistry.v2019_04_01.Registries scheduleRun" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun") Observable> scheduleRun(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Query("api-version") String apiVersion, @Body RunRequest runRequest, @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.containerregistry.v2019_04_01.Registries beginScheduleRun" }) - @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun") - Observable> beginScheduleRun(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Query("api-version") String apiVersion, @Body RunRequest runRequest, @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.containerregistry.v2019_04_01.Registries beginScheduleRun" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun") + Observable> beginScheduleRun(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Query("api-version") String apiVersion, @Body RunRequest runRequest, @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.containerregistry.v2019_04_01.Registries getBuildSourceUploadUrl" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listBuildSourceUploadUrl") + Observable> getBuildSourceUploadUrl(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @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.containerregistry.v2019_04_01.Registries 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.containerregistry.v2019_04_01.Registries listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Copies an image to this container registry from the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param parameters The parameters specifying the image to copy and the source container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void importImage(String resourceGroupName, String registryName, ImportImageParameters parameters) { + importImageWithServiceResponseAsync(resourceGroupName, registryName, parameters).toBlocking().last().body(); + } + + /** + * Copies an image to this container registry from the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param parameters The parameters specifying the image to copy and the source container registry. + * @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 importImageAsync(String resourceGroupName, String registryName, ImportImageParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(importImageWithServiceResponseAsync(resourceGroupName, registryName, parameters), serviceCallback); + } + + /** + * Copies an image to this container registry from the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param parameters The parameters specifying the image to copy and the source container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable importImageAsync(String resourceGroupName, String registryName, ImportImageParameters parameters) { + return importImageWithServiceResponseAsync(resourceGroupName, registryName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Copies an image to this container registry from the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param parameters The parameters specifying the image to copy and the source container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> importImageWithServiceResponseAsync(String resourceGroupName, String registryName, ImportImageParameters parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2017-10-01"; + Observable> observable = service.importImage(this.client.subscriptionId(), resourceGroupName, registryName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Copies an image to this container registry from the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param parameters The parameters specifying the image to copy and the source container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginImportImage(String resourceGroupName, String registryName, ImportImageParameters parameters) { + beginImportImageWithServiceResponseAsync(resourceGroupName, registryName, parameters).toBlocking().single().body(); + } + + /** + * Copies an image to this container registry from the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param parameters The parameters specifying the image to copy and the source container registry. + * @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 beginImportImageAsync(String resourceGroupName, String registryName, ImportImageParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginImportImageWithServiceResponseAsync(resourceGroupName, registryName, parameters), serviceCallback); + } + + /** + * Copies an image to this container registry from the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param parameters The parameters specifying the image to copy and the source container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginImportImageAsync(String resourceGroupName, String registryName, ImportImageParameters parameters) { + return beginImportImageWithServiceResponseAsync(resourceGroupName, registryName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Copies an image to this container registry from the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param parameters The parameters specifying the image to copy and the source container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginImportImageWithServiceResponseAsync(String resourceGroupName, String registryName, ImportImageParameters parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2017-10-01"; + return service.beginImportImage(this.client.subscriptionId(), resourceGroupName, registryName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginImportImageDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginImportImageDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Checks whether the container registry name is available for use. The name must contain only alphanumeric characters, be globally unique, and between 5 and 50 characters in length. + * + * @param name The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the RegistryNameStatusInner object if successful. + */ + public RegistryNameStatusInner checkNameAvailability(String name) { + return checkNameAvailabilityWithServiceResponseAsync(name).toBlocking().single().body(); + } + + /** + * Checks whether the container registry name is available for use. The name must contain only alphanumeric characters, be globally unique, and between 5 and 50 characters in length. + * + * @param name The name of the container registry. + * @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 checkNameAvailabilityAsync(String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkNameAvailabilityWithServiceResponseAsync(name), serviceCallback); + } + + /** + * Checks whether the container registry name is available for use. The name must contain only alphanumeric characters, be globally unique, and between 5 and 50 characters in length. + * + * @param name The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RegistryNameStatusInner object + */ + public Observable checkNameAvailabilityAsync(String name) { + return checkNameAvailabilityWithServiceResponseAsync(name).map(new Func1, RegistryNameStatusInner>() { + @Override + public RegistryNameStatusInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks whether the container registry name is available for use. The name must contain only alphanumeric characters, be globally unique, and between 5 and 50 characters in length. + * + * @param name The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RegistryNameStatusInner object + */ + public Observable> checkNameAvailabilityWithServiceResponseAsync(String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + final String apiVersion = "2017-10-01"; + RegistryNameCheckRequest registryNameCheckRequest = new RegistryNameCheckRequest(); + registryNameCheckRequest.withName(name); + return service.checkNameAvailability(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), registryNameCheckRequest, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkNameAvailabilityDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkNameAvailabilityDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the properties of the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the RegistryInner object if successful. + */ + public RegistryInner getByResourceGroup(String resourceGroupName, String registryName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, registryName).toBlocking().single().body(); + } + + /** + * Gets the properties of the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @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 registryName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, registryName), serviceCallback); + } + + /** + * Gets the properties of the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RegistryInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String registryName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, registryName).map(new Func1, RegistryInner>() { + @Override + public RegistryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the properties of the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RegistryInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String registryName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + final String apiVersion = "2017-10-01"; + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, registryName, 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registry The parameters for creating a container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the RegistryInner object if successful. + */ + public RegistryInner create(String resourceGroupName, String registryName, RegistryInner registry) { + return createWithServiceResponseAsync(resourceGroupName, registryName, registry).toBlocking().last().body(); + } + + /** + * Creates a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registry The parameters for creating a container registry. + * @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 createAsync(String resourceGroupName, String registryName, RegistryInner registry, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, registryName, registry), serviceCallback); + } + + /** + * Creates a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registry The parameters for creating a container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String registryName, RegistryInner registry) { + return createWithServiceResponseAsync(resourceGroupName, registryName, registry).map(new Func1, RegistryInner>() { + @Override + public RegistryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registry The parameters for creating a container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String registryName, RegistryInner registry) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (registry == null) { + throw new IllegalArgumentException("Parameter registry is required and cannot be null."); + } + Validator.validate(registry); + final String apiVersion = "2017-10-01"; + Observable> observable = service.create(this.client.subscriptionId(), resourceGroupName, registryName, apiVersion, registry, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registry The parameters for creating a container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the RegistryInner object if successful. + */ + public RegistryInner beginCreate(String resourceGroupName, String registryName, RegistryInner registry) { + return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, registry).toBlocking().single().body(); + } + + /** + * Creates a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registry The parameters for creating a container registry. + * @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 beginCreateAsync(String resourceGroupName, String registryName, RegistryInner registry, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, registryName, registry), serviceCallback); + } + + /** + * Creates a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registry The parameters for creating a container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RegistryInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String registryName, RegistryInner registry) { + return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, registry).map(new Func1, RegistryInner>() { + @Override + public RegistryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registry The parameters for creating a container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RegistryInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String registryName, RegistryInner registry) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (registry == null) { + throw new IllegalArgumentException("Parameter registry is required and cannot be null."); + } + Validator.validate(registry); + final String apiVersion = "2017-10-01"; + return service.beginCreate(this.client.subscriptionId(), resourceGroupName, registryName, apiVersion, registry, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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 registryName) { + deleteWithServiceResponseAsync(resourceGroupName, registryName).toBlocking().last().body(); + } + + /** + * Deletes a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @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 registryName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, registryName), serviceCallback); + } + + /** + * Deletes a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String registryName) { + return deleteWithServiceResponseAsync(resourceGroupName, registryName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String registryName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + final String apiVersion = "2017-10-01"; + Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, registryName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String registryName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, registryName).toBlocking().single().body(); + } + + /** + * Deletes a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @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 beginDeleteAsync(String resourceGroupName, String registryName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, registryName), serviceCallback); + } + + /** + * Deletes a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String registryName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, registryName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String registryName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + final String apiVersion = "2017-10-01"; + return service.beginDelete(this.client.subscriptionId(), resourceGroupName, registryName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registryUpdateParameters The parameters for updating a container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the RegistryInner object if successful. + */ + public RegistryInner update(String resourceGroupName, String registryName, RegistryUpdateParameters registryUpdateParameters) { + return updateWithServiceResponseAsync(resourceGroupName, registryName, registryUpdateParameters).toBlocking().last().body(); + } + + /** + * Updates a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registryUpdateParameters The parameters for updating a container registry. + * @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 registryName, RegistryUpdateParameters registryUpdateParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, registryName, registryUpdateParameters), serviceCallback); + } + + /** + * Updates a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registryUpdateParameters The parameters for updating a container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String registryName, RegistryUpdateParameters registryUpdateParameters) { + return updateWithServiceResponseAsync(resourceGroupName, registryName, registryUpdateParameters).map(new Func1, RegistryInner>() { + @Override + public RegistryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registryUpdateParameters The parameters for updating a container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String registryName, RegistryUpdateParameters registryUpdateParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (registryUpdateParameters == null) { + throw new IllegalArgumentException("Parameter registryUpdateParameters is required and cannot be null."); + } + Validator.validate(registryUpdateParameters); + final String apiVersion = "2017-10-01"; + Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, registryName, apiVersion, registryUpdateParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registryUpdateParameters The parameters for updating a container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the RegistryInner object if successful. + */ + public RegistryInner beginUpdate(String resourceGroupName, String registryName, RegistryUpdateParameters registryUpdateParameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, registryUpdateParameters).toBlocking().single().body(); + } + + /** + * Updates a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registryUpdateParameters The parameters for updating a container registry. + * @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 beginUpdateAsync(String resourceGroupName, String registryName, RegistryUpdateParameters registryUpdateParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, registryUpdateParameters), serviceCallback); + } + + /** + * Updates a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registryUpdateParameters The parameters for updating a container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RegistryInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String registryName, RegistryUpdateParameters registryUpdateParameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, registryUpdateParameters).map(new Func1, RegistryInner>() { + @Override + public RegistryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registryUpdateParameters The parameters for updating a container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RegistryInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String registryName, RegistryUpdateParameters registryUpdateParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (registryUpdateParameters == null) { + throw new IllegalArgumentException("Parameter registryUpdateParameters is required and cannot be null."); + } + Validator.validate(registryUpdateParameters); + final String apiVersion = "2017-10-01"; + return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, registryName, apiVersion, registryUpdateParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all the container registries under the specified resource group. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<RegistryInner> 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 the container registries under the specified resource group. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @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 the container registries under the specified resource group. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RegistryInner> 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 the container registries under the specified resource group. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RegistryInner> 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 the container registries under the specified resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RegistryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + final String apiVersion = "2017-10-01"; + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all the container registries under the specified subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<RegistryInner> 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 the container registries under the specified 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 the container registries under the specified subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RegistryInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the container registries under the specified subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RegistryInner> 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 the container registries under the specified subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RegistryInner> 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."); + } + final String apiVersion = "2017-10-01"; + return service.list(this.client.subscriptionId(), 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the login credentials for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the RegistryListCredentialsResultInner object if successful. + */ + public RegistryListCredentialsResultInner listCredentials(String resourceGroupName, String registryName) { + return listCredentialsWithServiceResponseAsync(resourceGroupName, registryName).toBlocking().single().body(); + } + + /** + * Lists the login credentials for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @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 listCredentialsAsync(String resourceGroupName, String registryName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listCredentialsWithServiceResponseAsync(resourceGroupName, registryName), serviceCallback); + } + + /** + * Lists the login credentials for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RegistryListCredentialsResultInner object + */ + public Observable listCredentialsAsync(String resourceGroupName, String registryName) { + return listCredentialsWithServiceResponseAsync(resourceGroupName, registryName).map(new Func1, RegistryListCredentialsResultInner>() { + @Override + public RegistryListCredentialsResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the login credentials for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RegistryListCredentialsResultInner object + */ + public Observable> listCredentialsWithServiceResponseAsync(String resourceGroupName, String registryName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + final String apiVersion = "2017-10-01"; + return service.listCredentials(this.client.subscriptionId(), resourceGroupName, registryName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listCredentialsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listCredentialsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Regenerates one of the login credentials for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param name Specifies name of the password which should be regenerated -- password or password2. Possible values include: 'password', 'password2' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the RegistryListCredentialsResultInner object if successful. + */ + public RegistryListCredentialsResultInner regenerateCredential(String resourceGroupName, String registryName, PasswordName name) { + return regenerateCredentialWithServiceResponseAsync(resourceGroupName, registryName, name).toBlocking().single().body(); + } + + /** + * Regenerates one of the login credentials for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param name Specifies name of the password which should be regenerated -- password or password2. Possible values include: 'password', 'password2' + * @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 regenerateCredentialAsync(String resourceGroupName, String registryName, PasswordName name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateCredentialWithServiceResponseAsync(resourceGroupName, registryName, name), serviceCallback); + } + + /** + * Regenerates one of the login credentials for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param name Specifies name of the password which should be regenerated -- password or password2. Possible values include: 'password', 'password2' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RegistryListCredentialsResultInner object + */ + public Observable regenerateCredentialAsync(String resourceGroupName, String registryName, PasswordName name) { + return regenerateCredentialWithServiceResponseAsync(resourceGroupName, registryName, name).map(new Func1, RegistryListCredentialsResultInner>() { + @Override + public RegistryListCredentialsResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates one of the login credentials for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param name Specifies name of the password which should be regenerated -- password or password2. Possible values include: 'password', 'password2' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RegistryListCredentialsResultInner object + */ + public Observable> regenerateCredentialWithServiceResponseAsync(String resourceGroupName, String registryName, PasswordName name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + final String apiVersion = "2017-10-01"; + RegenerateCredentialParameters regenerateCredentialParameters = new RegenerateCredentialParameters(); + regenerateCredentialParameters.withName(name); + return service.regenerateCredential(this.client.subscriptionId(), resourceGroupName, registryName, apiVersion, this.client.acceptLanguage(), regenerateCredentialParameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateCredentialDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse regenerateCredentialDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the quota usages for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the RegistryUsageListResultInner object if successful. + */ + public RegistryUsageListResultInner listUsages(String resourceGroupName, String registryName) { + return listUsagesWithServiceResponseAsync(resourceGroupName, registryName).toBlocking().single().body(); + } + + /** + * Gets the quota usages for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @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 listUsagesAsync(String resourceGroupName, String registryName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listUsagesWithServiceResponseAsync(resourceGroupName, registryName), serviceCallback); + } + + /** + * Gets the quota usages for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RegistryUsageListResultInner object + */ + public Observable listUsagesAsync(String resourceGroupName, String registryName) { + return listUsagesWithServiceResponseAsync(resourceGroupName, registryName).map(new Func1, RegistryUsageListResultInner>() { + @Override + public RegistryUsageListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the quota usages for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RegistryUsageListResultInner object + */ + public Observable> listUsagesWithServiceResponseAsync(String resourceGroupName, String registryName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + final String apiVersion = "2017-10-01"; + return service.listUsages(this.client.subscriptionId(), resourceGroupName, registryName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listUsagesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listUsagesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the policies for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the RegistryPoliciesInner object if successful. + */ + public RegistryPoliciesInner listPolicies(String resourceGroupName, String registryName) { + return listPoliciesWithServiceResponseAsync(resourceGroupName, registryName).toBlocking().single().body(); + } + + /** + * Lists the policies for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @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 listPoliciesAsync(String resourceGroupName, String registryName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listPoliciesWithServiceResponseAsync(resourceGroupName, registryName), serviceCallback); + } + + /** + * Lists the policies for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RegistryPoliciesInner object + */ + public Observable listPoliciesAsync(String resourceGroupName, String registryName) { + return listPoliciesWithServiceResponseAsync(resourceGroupName, registryName).map(new Func1, RegistryPoliciesInner>() { + @Override + public RegistryPoliciesInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the policies for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RegistryPoliciesInner object + */ + public Observable> listPoliciesWithServiceResponseAsync(String resourceGroupName, String registryName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + final String apiVersion = "2017-10-01"; + return service.listPolicies(this.client.subscriptionId(), resourceGroupName, registryName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listPoliciesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listPoliciesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerregistry.v2019_04_01.Registries getBuildSourceUploadUrl" }) - @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listBuildSourceUploadUrl") - Observable> getBuildSourceUploadUrl(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + /** + * Updates the policies for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registryPoliciesUpdateParameters The parameters for updating policies of a container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the RegistryPoliciesInner object if successful. + */ + public RegistryPoliciesInner updatePolicies(String resourceGroupName, String registryName, RegistryPoliciesInner registryPoliciesUpdateParameters) { + return updatePoliciesWithServiceResponseAsync(resourceGroupName, registryName, registryPoliciesUpdateParameters).toBlocking().last().body(); + } + + /** + * Updates the policies for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registryPoliciesUpdateParameters The parameters for updating policies of a container registry. + * @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 updatePoliciesAsync(String resourceGroupName, String registryName, RegistryPoliciesInner registryPoliciesUpdateParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updatePoliciesWithServiceResponseAsync(resourceGroupName, registryName, registryPoliciesUpdateParameters), serviceCallback); + } + + /** + * Updates the policies for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registryPoliciesUpdateParameters The parameters for updating policies of a container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updatePoliciesAsync(String resourceGroupName, String registryName, RegistryPoliciesInner registryPoliciesUpdateParameters) { + return updatePoliciesWithServiceResponseAsync(resourceGroupName, registryName, registryPoliciesUpdateParameters).map(new Func1, RegistryPoliciesInner>() { + @Override + public RegistryPoliciesInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the policies for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registryPoliciesUpdateParameters The parameters for updating policies of a container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updatePoliciesWithServiceResponseAsync(String resourceGroupName, String registryName, RegistryPoliciesInner registryPoliciesUpdateParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (registryPoliciesUpdateParameters == null) { + throw new IllegalArgumentException("Parameter registryPoliciesUpdateParameters is required and cannot be null."); + } + Validator.validate(registryPoliciesUpdateParameters); + final String apiVersion = "2017-10-01"; + Observable> observable = service.updatePolicies(this.client.subscriptionId(), resourceGroupName, registryName, apiVersion, registryPoliciesUpdateParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates the policies for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registryPoliciesUpdateParameters The parameters for updating policies of a container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the RegistryPoliciesInner object if successful. + */ + public RegistryPoliciesInner beginUpdatePolicies(String resourceGroupName, String registryName, RegistryPoliciesInner registryPoliciesUpdateParameters) { + return beginUpdatePoliciesWithServiceResponseAsync(resourceGroupName, registryName, registryPoliciesUpdateParameters).toBlocking().single().body(); + } + + /** + * Updates the policies for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registryPoliciesUpdateParameters The parameters for updating policies of a container registry. + * @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 beginUpdatePoliciesAsync(String resourceGroupName, String registryName, RegistryPoliciesInner registryPoliciesUpdateParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdatePoliciesWithServiceResponseAsync(resourceGroupName, registryName, registryPoliciesUpdateParameters), serviceCallback); + } + + /** + * Updates the policies for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registryPoliciesUpdateParameters The parameters for updating policies of a container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RegistryPoliciesInner object + */ + public Observable beginUpdatePoliciesAsync(String resourceGroupName, String registryName, RegistryPoliciesInner registryPoliciesUpdateParameters) { + return beginUpdatePoliciesWithServiceResponseAsync(resourceGroupName, registryName, registryPoliciesUpdateParameters).map(new Func1, RegistryPoliciesInner>() { + @Override + public RegistryPoliciesInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the policies for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param registryPoliciesUpdateParameters The parameters for updating policies of a container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RegistryPoliciesInner object + */ + public Observable> beginUpdatePoliciesWithServiceResponseAsync(String resourceGroupName, String registryName, RegistryPoliciesInner registryPoliciesUpdateParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (registryPoliciesUpdateParameters == null) { + throw new IllegalArgumentException("Parameter registryPoliciesUpdateParameters is required and cannot be null."); + } + Validator.validate(registryPoliciesUpdateParameters); + final String apiVersion = "2017-10-01"; + return service.beginUpdatePolicies(this.client.subscriptionId(), resourceGroupName, registryName, apiVersion, registryPoliciesUpdateParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdatePoliciesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + private ServiceResponse beginUpdatePoliciesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); } /** @@ -134,14 +1779,12 @@ public Observable> scheduleRunWithServiceResponseAsync if (registryName == null) { throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } if (runRequest == null) { throw new IllegalArgumentException("Parameter runRequest is required and cannot be null."); } Validator.validate(runRequest); - Observable> observable = service.scheduleRun(this.client.subscriptionId(), resourceGroupName, registryName, this.client.apiVersion(), runRequest, this.client.acceptLanguage(), this.client.userAgent()); + final String apiVersion = "2019-04-01"; + Observable> observable = service.scheduleRun(this.client.subscriptionId(), resourceGroupName, registryName, apiVersion, runRequest, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } @@ -211,14 +1854,12 @@ public Observable> beginScheduleRunWithServiceResponse if (registryName == null) { throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } if (runRequest == null) { throw new IllegalArgumentException("Parameter runRequest is required and cannot be null."); } Validator.validate(runRequest); - return service.beginScheduleRun(this.client.subscriptionId(), resourceGroupName, registryName, this.client.apiVersion(), runRequest, this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2019-04-01"; + return service.beginScheduleRun(this.client.subscriptionId(), resourceGroupName, registryName, apiVersion, runRequest, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -302,10 +1943,8 @@ public Observable> getBuildSourceUp if (registryName == null) { throw new IllegalArgumentException("Parameter registryName 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.getBuildSourceUploadUrl(this.client.subscriptionId(), resourceGroupName, registryName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2019-04-01"; + return service.getBuildSourceUploadUrl(this.client.subscriptionId(), resourceGroupName, registryName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -326,4 +1965,226 @@ private ServiceResponse getBuildSourceUploadUrlDele .build(response); } + /** + * Lists all the container registries under the specified resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<RegistryInner> 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 the container registries under the specified 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 the container registries under the specified 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<RegistryInner> 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 the container registries under the specified 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<RegistryInner> 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 the container registries under the specified 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<RegistryInner> 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all the container registries under the specified subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<RegistryInner> 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 the container registries under the specified 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 the container registries under the specified 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<RegistryInner> 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 the container registries under the specified 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<RegistryInner> 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 the container registries under the specified 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<RegistryInner> 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + } diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryImpl.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryImpl.java new file mode 100644 index 000000000000..b841345f1a54 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryImpl.java @@ -0,0 +1,153 @@ +/** + * 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.containerregistry.v2019_04_01.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.containerregistry.v2019_04_01.Registry; +import rx.Observable; +import com.microsoft.azure.management.containerregistry.v2019_04_01.RegistryUpdateParameters; +import com.microsoft.azure.management.containerregistry.v2019_04_01.Sku; +import org.joda.time.DateTime; +import com.microsoft.azure.management.containerregistry.v2019_04_01.ProvisioningState; +import com.microsoft.azure.management.containerregistry.v2019_04_01.Status; +import com.microsoft.azure.management.containerregistry.v2019_04_01.StorageAccountProperties; +import com.microsoft.azure.management.containerregistry.v2019_04_01.NetworkRuleSet; +import rx.functions.Func1; + +class RegistryImpl extends GroupableResourceCoreImpl implements Registry, Registry.Definition, Registry.Update { + private RegistryUpdateParameters updateParameter; + RegistryImpl(String name, RegistryInner inner, ContainerRegistryManager manager) { + super(name, inner, manager); + this.updateParameter = new RegistryUpdateParameters(); + } + + @Override + public Observable createResourceAsync() { + RegistriesInner client = this.manager().inner().registries(); + return client.createAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(new Func1() { + @Override + public RegistryInner call(RegistryInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + RegistriesInner client = this.manager().inner().registries(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public RegistryInner call(RegistryInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + RegistriesInner client = this.manager().inner().registries(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new RegistryUpdateParameters(); + } + + @Override + public Boolean adminUserEnabled() { + return this.inner().adminUserEnabled(); + } + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public String loginServer() { + return this.inner().loginServer(); + } + + @Override + public NetworkRuleSet networkRuleSet() { + return this.inner().networkRuleSet(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @Override + public Status status() { + return this.inner().status(); + } + + @Override + public StorageAccountProperties storageAccount() { + return this.inner().storageAccount(); + } + + @Override + public RegistryImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.inner().withSku(sku); + } else { + this.updateParameter.withSku(sku); + } + return this; + } + + @Override + public RegistryImpl withAdminUserEnabled(Boolean adminUserEnabled) { + if (isInCreateMode()) { + this.inner().withAdminUserEnabled(adminUserEnabled); + } else { + this.updateParameter.withAdminUserEnabled(adminUserEnabled); + } + return this; + } + + @Override + public RegistryImpl withNetworkRuleSet(NetworkRuleSet networkRuleSet) { + if (isInCreateMode()) { + this.inner().withNetworkRuleSet(networkRuleSet); + } else { + this.updateParameter.withNetworkRuleSet(networkRuleSet); + } + return this; + } + + @Override + public RegistryImpl withStorageAccount(StorageAccountProperties storageAccount) { + if (isInCreateMode()) { + this.inner().withStorageAccount(storageAccount); + } else { + this.updateParameter.withStorageAccount(storageAccount); + } + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryInner.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryInner.java new file mode 100644 index 000000000000..f34e36f95345 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryInner.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.containerregistry.v2019_04_01.implementation; + +import com.microsoft.azure.management.containerregistry.v2019_04_01.Sku; +import org.joda.time.DateTime; +import com.microsoft.azure.management.containerregistry.v2019_04_01.ProvisioningState; +import com.microsoft.azure.management.containerregistry.v2019_04_01.Status; +import com.microsoft.azure.management.containerregistry.v2019_04_01.StorageAccountProperties; +import com.microsoft.azure.management.containerregistry.v2019_04_01.NetworkRuleSet; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An object that represents a container registry. + */ +@JsonFlatten +public class RegistryInner extends Resource { + /** + * The SKU of the container registry. + */ + @JsonProperty(value = "sku", required = true) + private Sku sku; + + /** + * The URL that can be used to log into the container registry. + */ + @JsonProperty(value = "properties.loginServer", access = JsonProperty.Access.WRITE_ONLY) + private String loginServer; + + /** + * The creation date of the container registry in ISO8601 format. + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The provisioning state of the container registry at the time the + * operation was called. Possible values include: 'Creating', 'Updating', + * 'Deleting', 'Succeeded', 'Failed', 'Canceled'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * The status of the container registry at the time the operation was + * called. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private Status status; + + /** + * The value that indicates whether the admin user is enabled. + */ + @JsonProperty(value = "properties.adminUserEnabled") + private Boolean adminUserEnabled; + + /** + * The properties of the storage account for the container registry. Only + * applicable to Classic SKU. + */ + @JsonProperty(value = "properties.storageAccount") + private StorageAccountProperties storageAccount; + + /** + * The network rule set for a container registry. + */ + @JsonProperty(value = "properties.networkRuleSet") + private NetworkRuleSet networkRuleSet; + + /** + * Get the SKU of the container registry. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the SKU of the container registry. + * + * @param sku the sku value to set + * @return the RegistryInner object itself. + */ + public RegistryInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the URL that can be used to log into the container registry. + * + * @return the loginServer value + */ + public String loginServer() { + return this.loginServer; + } + + /** + * Get the creation date of the container registry in ISO8601 format. + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the provisioning state of the container registry at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the status of the container registry at the time the operation was called. + * + * @return the status value + */ + public Status status() { + return this.status; + } + + /** + * Get the value that indicates whether the admin user is enabled. + * + * @return the adminUserEnabled value + */ + public Boolean adminUserEnabled() { + return this.adminUserEnabled; + } + + /** + * Set the value that indicates whether the admin user is enabled. + * + * @param adminUserEnabled the adminUserEnabled value to set + * @return the RegistryInner object itself. + */ + public RegistryInner withAdminUserEnabled(Boolean adminUserEnabled) { + this.adminUserEnabled = adminUserEnabled; + return this; + } + + /** + * Get the properties of the storage account for the container registry. Only applicable to Classic SKU. + * + * @return the storageAccount value + */ + public StorageAccountProperties storageAccount() { + return this.storageAccount; + } + + /** + * Set the properties of the storage account for the container registry. Only applicable to Classic SKU. + * + * @param storageAccount the storageAccount value to set + * @return the RegistryInner object itself. + */ + public RegistryInner withStorageAccount(StorageAccountProperties storageAccount) { + this.storageAccount = storageAccount; + return this; + } + + /** + * Get the network rule set for a container registry. + * + * @return the networkRuleSet value + */ + public NetworkRuleSet networkRuleSet() { + return this.networkRuleSet; + } + + /** + * Set the network rule set for a container registry. + * + * @param networkRuleSet the networkRuleSet value to set + * @return the RegistryInner object itself. + */ + public RegistryInner withNetworkRuleSet(NetworkRuleSet networkRuleSet) { + this.networkRuleSet = networkRuleSet; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryListCredentialsResultImpl.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryListCredentialsResultImpl.java new file mode 100644 index 000000000000..e3d74e40f17d --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryListCredentialsResultImpl.java @@ -0,0 +1,38 @@ +/** + * 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.containerregistry.v2019_04_01.implementation; + +import com.microsoft.azure.management.containerregistry.v2019_04_01.RegistryListCredentialsResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.containerregistry.v2019_04_01.RegistryPassword; + +class RegistryListCredentialsResultImpl extends WrapperImpl implements RegistryListCredentialsResult { + private final ContainerRegistryManager manager; + RegistryListCredentialsResultImpl(RegistryListCredentialsResultInner inner, ContainerRegistryManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ContainerRegistryManager manager() { + return this.manager; + } + + @Override + public List passwords() { + return this.inner().passwords(); + } + + @Override + public String username() { + return this.inner().username(); + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryListCredentialsResultInner.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryListCredentialsResultInner.java new file mode 100644 index 000000000000..601e701e3251 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryListCredentialsResultInner.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.containerregistry.v2019_04_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.containerregistry.v2019_04_01.RegistryPassword; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The response from the ListCredentials operation. + */ +public class RegistryListCredentialsResultInner { + /** + * The username for a container registry. + */ + @JsonProperty(value = "username") + private String username; + + /** + * The list of passwords for a container registry. + */ + @JsonProperty(value = "passwords") + private List passwords; + + /** + * Get the username for a container registry. + * + * @return the username value + */ + public String username() { + return this.username; + } + + /** + * Set the username for a container registry. + * + * @param username the username value to set + * @return the RegistryListCredentialsResultInner object itself. + */ + public RegistryListCredentialsResultInner withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the list of passwords for a container registry. + * + * @return the passwords value + */ + public List passwords() { + return this.passwords; + } + + /** + * Set the list of passwords for a container registry. + * + * @param passwords the passwords value to set + * @return the RegistryListCredentialsResultInner object itself. + */ + public RegistryListCredentialsResultInner withPasswords(List passwords) { + this.passwords = passwords; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryNameStatusImpl.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryNameStatusImpl.java new file mode 100644 index 000000000000..6225491867bc --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryNameStatusImpl.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.containerregistry.v2019_04_01.implementation; + +import com.microsoft.azure.management.containerregistry.v2019_04_01.RegistryNameStatus; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class RegistryNameStatusImpl extends WrapperImpl implements RegistryNameStatus { + private final ContainerRegistryManager manager; + RegistryNameStatusImpl(RegistryNameStatusInner inner, ContainerRegistryManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ContainerRegistryManager manager() { + return this.manager; + } + + @Override + public String message() { + return this.inner().message(); + } + + @Override + public Boolean nameAvailable() { + return this.inner().nameAvailable(); + } + + @Override + public String reason() { + return this.inner().reason(); + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryNameStatusInner.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryNameStatusInner.java new file mode 100644 index 000000000000..12f34e294d4f --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryNameStatusInner.java @@ -0,0 +1,97 @@ +/** + * 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.containerregistry.v2019_04_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The result of a request to check the availability of a container registry + * name. + */ +public class RegistryNameStatusInner { + /** + * The value that indicates whether the name is available. + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /** + * If any, the reason that the name is not available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * If any, the error message that provides more detail for the reason that + * the name is not available. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the value that indicates whether the name is available. + * + * @return the nameAvailable value + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set the value that indicates whether the name is available. + * + * @param nameAvailable the nameAvailable value to set + * @return the RegistryNameStatusInner object itself. + */ + public RegistryNameStatusInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get if any, the reason that the name is not available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set if any, the reason that the name is not available. + * + * @param reason the reason value to set + * @return the RegistryNameStatusInner object itself. + */ + public RegistryNameStatusInner withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Get if any, the error message that provides more detail for the reason that the name is not available. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set if any, the error message that provides more detail for the reason that the name is not available. + * + * @param message the message value to set + * @return the RegistryNameStatusInner object itself. + */ + public RegistryNameStatusInner withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryPoliciesImpl.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryPoliciesImpl.java new file mode 100644 index 000000000000..a390fd5dbc86 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryPoliciesImpl.java @@ -0,0 +1,38 @@ +/** + * 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.containerregistry.v2019_04_01.implementation; + +import com.microsoft.azure.management.containerregistry.v2019_04_01.RegistryPolicies; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.containerregistry.v2019_04_01.QuarantinePolicy; +import com.microsoft.azure.management.containerregistry.v2019_04_01.TrustPolicy; + +class RegistryPoliciesImpl extends WrapperImpl implements RegistryPolicies { + private final ContainerRegistryManager manager; + RegistryPoliciesImpl(RegistryPoliciesInner inner, ContainerRegistryManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ContainerRegistryManager manager() { + return this.manager; + } + + @Override + public QuarantinePolicy quarantinePolicy() { + return this.inner().quarantinePolicy(); + } + + @Override + public TrustPolicy trustPolicy() { + return this.inner().trustPolicy(); + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryPoliciesInner.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryPoliciesInner.java new file mode 100644 index 000000000000..c56822183f47 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryPoliciesInner.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.containerregistry.v2019_04_01.implementation; + +import com.microsoft.azure.management.containerregistry.v2019_04_01.QuarantinePolicy; +import com.microsoft.azure.management.containerregistry.v2019_04_01.TrustPolicy; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An object that represents policies for a container registry. + */ +public class RegistryPoliciesInner { + /** + * An object that represents quarantine policy for a container registry. + */ + @JsonProperty(value = "quarantinePolicy") + private QuarantinePolicy quarantinePolicy; + + /** + * An object that represents content trust policy for a container registry. + */ + @JsonProperty(value = "trustPolicy") + private TrustPolicy trustPolicy; + + /** + * Get an object that represents quarantine policy for a container registry. + * + * @return the quarantinePolicy value + */ + public QuarantinePolicy quarantinePolicy() { + return this.quarantinePolicy; + } + + /** + * Set an object that represents quarantine policy for a container registry. + * + * @param quarantinePolicy the quarantinePolicy value to set + * @return the RegistryPoliciesInner object itself. + */ + public RegistryPoliciesInner withQuarantinePolicy(QuarantinePolicy quarantinePolicy) { + this.quarantinePolicy = quarantinePolicy; + return this; + } + + /** + * Get an object that represents content trust policy for a container registry. + * + * @return the trustPolicy value + */ + public TrustPolicy trustPolicy() { + return this.trustPolicy; + } + + /** + * Set an object that represents content trust policy for a container registry. + * + * @param trustPolicy the trustPolicy value to set + * @return the RegistryPoliciesInner object itself. + */ + public RegistryPoliciesInner withTrustPolicy(TrustPolicy trustPolicy) { + this.trustPolicy = trustPolicy; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryUsageListResultImpl.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryUsageListResultImpl.java new file mode 100644 index 000000000000..890075b06e46 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryUsageListResultImpl.java @@ -0,0 +1,33 @@ +/** + * 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.containerregistry.v2019_04_01.implementation; + +import com.microsoft.azure.management.containerregistry.v2019_04_01.RegistryUsageListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.containerregistry.v2019_04_01.RegistryUsage; + +class RegistryUsageListResultImpl extends WrapperImpl implements RegistryUsageListResult { + private final ContainerRegistryManager manager; + RegistryUsageListResultImpl(RegistryUsageListResultInner inner, ContainerRegistryManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ContainerRegistryManager manager() { + return this.manager; + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryUsageListResultInner.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryUsageListResultInner.java new file mode 100644 index 000000000000..2fa5e2abb2ce --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RegistryUsageListResultInner.java @@ -0,0 +1,45 @@ +/** + * 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.containerregistry.v2019_04_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.containerregistry.v2019_04_01.RegistryUsage; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The result of a request to get container registry quota usages. + */ +public class RegistryUsageListResultInner { + /** + * The list of container registry quota usages. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the list of container registry quota usages. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the list of container registry quota usages. + * + * @param value the value value to set + * @return the RegistryUsageListResultInner object itself. + */ + public RegistryUsageListResultInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/ReplicationImpl.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/ReplicationImpl.java new file mode 100644 index 000000000000..865aa439a8e8 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/ReplicationImpl.java @@ -0,0 +1,129 @@ +/** + * 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.containerregistry.v2019_04_01.implementation; + +import com.microsoft.azure.management.containerregistry.v2019_04_01.Replication; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.Map; +import com.microsoft.azure.management.containerregistry.v2019_04_01.ProvisioningState; +import com.microsoft.azure.management.containerregistry.v2019_04_01.Status; + +class ReplicationImpl extends CreatableUpdatableImpl implements Replication, Replication.Definition, Replication.Update { + private final ContainerRegistryManager manager; + private String resourceGroupName; + private String registryName; + private String replicationName; + + ReplicationImpl(String name, ContainerRegistryManager manager) { + super(name, new ReplicationInner()); + this.manager = manager; + // Set resource name + this.replicationName = name; + // + } + + ReplicationImpl(ReplicationInner inner, ContainerRegistryManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.replicationName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.registryName = IdParsingUtils.getValueFromIdByName(inner.id(), "registries"); + this.replicationName = IdParsingUtils.getValueFromIdByName(inner.id(), "replications"); + // + } + + @Override + public ContainerRegistryManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ReplicationsInner client = this.manager().inner().replications(); + return client.createAsync(this.resourceGroupName, this.registryName, this.replicationName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ReplicationsInner client = this.manager().inner().replications(); + return client.createAsync(this.resourceGroupName, this.registryName, this.replicationName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ReplicationsInner client = this.manager().inner().replications(); + return client.getAsync(this.resourceGroupName, this.registryName, this.replicationName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public Status status() { + return this.inner().status(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ReplicationImpl withExistingRegistry(String resourceGroupName, String registryName) { + this.resourceGroupName = resourceGroupName; + this.registryName = registryName; + return this; + } + + @Override + public ReplicationImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public ReplicationImpl withTags(Map tags) { + this.inner().withTags(tags); + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/ReplicationInner.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/ReplicationInner.java new file mode 100644 index 000000000000..e44a28138a5e --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/ReplicationInner.java @@ -0,0 +1,54 @@ +/** + * 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.containerregistry.v2019_04_01.implementation; + +import com.microsoft.azure.management.containerregistry.v2019_04_01.ProvisioningState; +import com.microsoft.azure.management.containerregistry.v2019_04_01.Status; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An object that represents a replication for a container registry. + */ +@JsonFlatten +public class ReplicationInner extends Resource { + /** + * The provisioning state of the replication at the time the operation was + * called. Possible values include: 'Creating', 'Updating', 'Deleting', + * 'Succeeded', 'Failed', 'Canceled'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * The status of the replication at the time the operation was called. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private Status status; + + /** + * Get the provisioning state of the replication at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the status of the replication at the time the operation was called. + * + * @return the status value + */ + public Status status() { + return this.status; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/ReplicationsImpl.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/ReplicationsImpl.java new file mode 100644 index 000000000000..6d80cb578c38 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/ReplicationsImpl.java @@ -0,0 +1,81 @@ +/** + * 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.containerregistry.v2019_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.containerregistry.v2019_04_01.Replications; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.containerregistry.v2019_04_01.Replication; + +class ReplicationsImpl extends WrapperImpl implements Replications { + private final ContainerRegistryManager manager; + + ReplicationsImpl(ContainerRegistryManager manager) { + super(manager.inner().replications()); + this.manager = manager; + } + + public ContainerRegistryManager manager() { + return this.manager; + } + + @Override + public ReplicationImpl define(String name) { + return wrapModel(name); + } + + private ReplicationImpl wrapModel(ReplicationInner inner) { + return new ReplicationImpl(inner, manager()); + } + + private ReplicationImpl wrapModel(String name) { + return new ReplicationImpl(name, this.manager()); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String registryName) { + ReplicationsInner client = this.inner(); + return client.listAsync(resourceGroupName, registryName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Replication call(ReplicationInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String registryName, String replicationName) { + ReplicationsInner client = this.inner(); + return client.getAsync(resourceGroupName, registryName, replicationName) + .map(new Func1() { + @Override + public Replication call(ReplicationInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String registryName, String replicationName) { + ReplicationsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, registryName, replicationName).toCompletable(); + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/ReplicationsInner.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/ReplicationsInner.java new file mode 100644 index 000000000000..22c0f4058ddd --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/ReplicationsInner.java @@ -0,0 +1,1118 @@ +/** + * 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.containerregistry.v2019_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.containerregistry.v2019_04_01.ReplicationUpdateParameters; +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 Replications. + */ +public class ReplicationsInner { + /** The Retrofit service to perform REST calls. */ + private ReplicationsService service; + /** The service client containing this operation class. */ + private ContainerRegistryManagementClientImpl client; + + /** + * Initializes an instance of ReplicationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReplicationsInner(Retrofit retrofit, ContainerRegistryManagementClientImpl client) { + this.service = retrofit.create(ReplicationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Replications to be + * used by Retrofit to perform actually REST calls. + */ + interface ReplicationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerregistry.v2019_04_01.Replications get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("replicationName") String replicationName, @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.containerregistry.v2019_04_01.Replications create" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}") + Observable> create(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("replicationName") String replicationName, @Query("api-version") String apiVersion, @Body ReplicationInner replication, @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.containerregistry.v2019_04_01.Replications beginCreate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}") + Observable> beginCreate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("replicationName") String replicationName, @Query("api-version") String apiVersion, @Body ReplicationInner replication, @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.containerregistry.v2019_04_01.Replications delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("replicationName") String replicationName, @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.containerregistry.v2019_04_01.Replications beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("replicationName") String replicationName, @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.containerregistry.v2019_04_01.Replications update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("replicationName") String replicationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ReplicationUpdateParameters replicationUpdateParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerregistry.v2019_04_01.Replications beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}") + Observable> beginUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("replicationName") String replicationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ReplicationUpdateParameters replicationUpdateParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerregistry.v2019_04_01.Replications list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @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.containerregistry.v2019_04_01.Replications listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the properties of the specified replication. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ReplicationInner object if successful. + */ + public ReplicationInner get(String resourceGroupName, String registryName, String replicationName) { + return getWithServiceResponseAsync(resourceGroupName, registryName, replicationName).toBlocking().single().body(); + } + + /** + * Gets the properties of the specified replication. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @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 registryName, String replicationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, registryName, replicationName), serviceCallback); + } + + /** + * Gets the properties of the specified replication. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ReplicationInner object + */ + public Observable getAsync(String resourceGroupName, String registryName, String replicationName) { + return getWithServiceResponseAsync(resourceGroupName, registryName, replicationName).map(new Func1, ReplicationInner>() { + @Override + public ReplicationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the properties of the specified replication. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ReplicationInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String registryName, String replicationName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (replicationName == null) { + throw new IllegalArgumentException("Parameter replicationName is required and cannot be null."); + } + final String apiVersion = "2017-10-01"; + return service.get(this.client.subscriptionId(), resourceGroupName, registryName, replicationName, 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates a replication for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @param replication The parameters for creating a replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ReplicationInner object if successful. + */ + public ReplicationInner create(String resourceGroupName, String registryName, String replicationName, ReplicationInner replication) { + return createWithServiceResponseAsync(resourceGroupName, registryName, replicationName, replication).toBlocking().last().body(); + } + + /** + * Creates a replication for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @param replication The parameters for creating a replication. + * @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 createAsync(String resourceGroupName, String registryName, String replicationName, ReplicationInner replication, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, registryName, replicationName, replication), serviceCallback); + } + + /** + * Creates a replication for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @param replication The parameters for creating a replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String registryName, String replicationName, ReplicationInner replication) { + return createWithServiceResponseAsync(resourceGroupName, registryName, replicationName, replication).map(new Func1, ReplicationInner>() { + @Override + public ReplicationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a replication for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @param replication The parameters for creating a replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String registryName, String replicationName, ReplicationInner replication) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (replicationName == null) { + throw new IllegalArgumentException("Parameter replicationName is required and cannot be null."); + } + if (replication == null) { + throw new IllegalArgumentException("Parameter replication is required and cannot be null."); + } + Validator.validate(replication); + final String apiVersion = "2017-10-01"; + Observable> observable = service.create(this.client.subscriptionId(), resourceGroupName, registryName, replicationName, apiVersion, replication, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a replication for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @param replication The parameters for creating a replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ReplicationInner object if successful. + */ + public ReplicationInner beginCreate(String resourceGroupName, String registryName, String replicationName, ReplicationInner replication) { + return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, replicationName, replication).toBlocking().single().body(); + } + + /** + * Creates a replication for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @param replication The parameters for creating a replication. + * @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 beginCreateAsync(String resourceGroupName, String registryName, String replicationName, ReplicationInner replication, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, registryName, replicationName, replication), serviceCallback); + } + + /** + * Creates a replication for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @param replication The parameters for creating a replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ReplicationInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String registryName, String replicationName, ReplicationInner replication) { + return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, replicationName, replication).map(new Func1, ReplicationInner>() { + @Override + public ReplicationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a replication for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @param replication The parameters for creating a replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ReplicationInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String registryName, String replicationName, ReplicationInner replication) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (replicationName == null) { + throw new IllegalArgumentException("Parameter replicationName is required and cannot be null."); + } + if (replication == null) { + throw new IllegalArgumentException("Parameter replication is required and cannot be null."); + } + Validator.validate(replication); + final String apiVersion = "2017-10-01"; + return service.beginCreate(this.client.subscriptionId(), resourceGroupName, registryName, replicationName, apiVersion, replication, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a replication from a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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 registryName, String replicationName) { + deleteWithServiceResponseAsync(resourceGroupName, registryName, replicationName).toBlocking().last().body(); + } + + /** + * Deletes a replication from a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @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 registryName, String replicationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, registryName, replicationName), serviceCallback); + } + + /** + * Deletes a replication from a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String registryName, String replicationName) { + return deleteWithServiceResponseAsync(resourceGroupName, registryName, replicationName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a replication from a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String registryName, String replicationName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (replicationName == null) { + throw new IllegalArgumentException("Parameter replicationName is required and cannot be null."); + } + final String apiVersion = "2017-10-01"; + Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, registryName, replicationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a replication from a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String registryName, String replicationName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, registryName, replicationName).toBlocking().single().body(); + } + + /** + * Deletes a replication from a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @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 beginDeleteAsync(String resourceGroupName, String registryName, String replicationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, registryName, replicationName), serviceCallback); + } + + /** + * Deletes a replication from a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String registryName, String replicationName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, registryName, replicationName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a replication from a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String registryName, String replicationName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (replicationName == null) { + throw new IllegalArgumentException("Parameter replicationName is required and cannot be null."); + } + final String apiVersion = "2017-10-01"; + return service.beginDelete(this.client.subscriptionId(), resourceGroupName, registryName, replicationName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates a replication for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ReplicationInner object if successful. + */ + public ReplicationInner update(String resourceGroupName, String registryName, String replicationName) { + return updateWithServiceResponseAsync(resourceGroupName, registryName, replicationName).toBlocking().last().body(); + } + + /** + * Updates a replication for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @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 registryName, String replicationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, registryName, replicationName), serviceCallback); + } + + /** + * Updates a replication for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String registryName, String replicationName) { + return updateWithServiceResponseAsync(resourceGroupName, registryName, replicationName).map(new Func1, ReplicationInner>() { + @Override + public ReplicationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a replication for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String registryName, String replicationName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (replicationName == null) { + throw new IllegalArgumentException("Parameter replicationName is required and cannot be null."); + } + final String apiVersion = "2017-10-01"; + final Map tags = null; + ReplicationUpdateParameters replicationUpdateParameters = new ReplicationUpdateParameters(); + replicationUpdateParameters.withTags(null); + Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, registryName, replicationName, apiVersion, this.client.acceptLanguage(), replicationUpdateParameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Updates a replication for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @param tags The tags for the replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ReplicationInner object if successful. + */ + public ReplicationInner update(String resourceGroupName, String registryName, String replicationName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, registryName, replicationName, tags).toBlocking().last().body(); + } + + /** + * Updates a replication for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @param tags The tags for the replication. + * @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 registryName, String replicationName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, registryName, replicationName, tags), serviceCallback); + } + + /** + * Updates a replication for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @param tags The tags for the replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String registryName, String replicationName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, registryName, replicationName, tags).map(new Func1, ReplicationInner>() { + @Override + public ReplicationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a replication for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @param tags The tags for the replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String registryName, String replicationName, Map tags) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (replicationName == null) { + throw new IllegalArgumentException("Parameter replicationName is required and cannot be null."); + } + Validator.validate(tags); + final String apiVersion = "2017-10-01"; + ReplicationUpdateParameters replicationUpdateParameters = new ReplicationUpdateParameters(); + replicationUpdateParameters.withTags(tags); + Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, registryName, replicationName, apiVersion, this.client.acceptLanguage(), replicationUpdateParameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a replication for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ReplicationInner object if successful. + */ + public ReplicationInner beginUpdate(String resourceGroupName, String registryName, String replicationName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, replicationName).toBlocking().single().body(); + } + + /** + * Updates a replication for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @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 beginUpdateAsync(String resourceGroupName, String registryName, String replicationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, replicationName), serviceCallback); + } + + /** + * Updates a replication for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ReplicationInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String registryName, String replicationName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, replicationName).map(new Func1, ReplicationInner>() { + @Override + public ReplicationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a replication for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ReplicationInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String registryName, String replicationName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (replicationName == null) { + throw new IllegalArgumentException("Parameter replicationName is required and cannot be null."); + } + final String apiVersion = "2017-10-01"; + final Map tags = null; + ReplicationUpdateParameters replicationUpdateParameters = new ReplicationUpdateParameters(); + replicationUpdateParameters.withTags(null); + return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, registryName, replicationName, apiVersion, this.client.acceptLanguage(), replicationUpdateParameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates a replication for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @param tags The tags for the replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ReplicationInner object if successful. + */ + public ReplicationInner beginUpdate(String resourceGroupName, String registryName, String replicationName, Map tags) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, replicationName, tags).toBlocking().single().body(); + } + + /** + * Updates a replication for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @param tags The tags for the replication. + * @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 beginUpdateAsync(String resourceGroupName, String registryName, String replicationName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, replicationName, tags), serviceCallback); + } + + /** + * Updates a replication for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @param tags The tags for the replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ReplicationInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String registryName, String replicationName, Map tags) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, replicationName, tags).map(new Func1, ReplicationInner>() { + @Override + public ReplicationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a replication for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param replicationName The name of the replication. + * @param tags The tags for the replication. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ReplicationInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String registryName, String replicationName, Map tags) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (replicationName == null) { + throw new IllegalArgumentException("Parameter replicationName is required and cannot be null."); + } + Validator.validate(tags); + final String apiVersion = "2017-10-01"; + ReplicationUpdateParameters replicationUpdateParameters = new ReplicationUpdateParameters(); + replicationUpdateParameters.withTags(tags); + return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, registryName, replicationName, apiVersion, this.client.acceptLanguage(), replicationUpdateParameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all the replications for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ReplicationInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String registryName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, registryName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all the replications for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @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 resourceGroupName, final String registryName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, registryName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all the replications for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReplicationInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String registryName) { + return listWithServiceResponseAsync(resourceGroupName, registryName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the replications for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReplicationInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String registryName) { + return listSinglePageAsync(resourceGroupName, registryName) + .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 the replications for the specified container registry. + * + ServiceResponse> * @param resourceGroupName The name of the resource group to which the container registry belongs. + ServiceResponse> * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReplicationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String registryName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + final String apiVersion = "2017-10-01"; + return service.list(this.client.subscriptionId(), resourceGroupName, registryName, 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all the replications for the specified container registry. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ReplicationInner> 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 the replications for the specified container registry. + * + * @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 the replications for the specified container registry. + * + * @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<ReplicationInner> 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 the replications for the specified container registry. + * + * @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<ReplicationInner> 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 the replications for the specified container registry. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReplicationInner> 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RunsInner.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RunsInner.java index 5b442784a4db..133cc4718bed 100644 --- a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RunsInner.java +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/RunsInner.java @@ -194,12 +194,10 @@ public Observable>> listSinglePageAsync(final Str if (registryName == null) { throw new IllegalArgumentException("Parameter registryName 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 apiVersion = "2019-04-01"; final String filter = null; final Integer top = null; - return service.list(this.client.subscriptionId(), resourceGroupName, registryName, this.client.apiVersion(), filter, top, this.client.acceptLanguage(), this.client.userAgent()) + return service.list(this.client.subscriptionId(), resourceGroupName, registryName, apiVersion, filter, top, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -322,10 +320,8 @@ public Observable>> listSinglePageAsync(final Str if (registryName == null) { throw new IllegalArgumentException("Parameter registryName 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(), resourceGroupName, registryName, this.client.apiVersion(), filter, top, this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2019-04-01"; + return service.list(this.client.subscriptionId(), resourceGroupName, registryName, apiVersion, filter, top, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -415,10 +411,8 @@ public Observable> getWithServiceResponseAsync(String if (runId == null) { throw new IllegalArgumentException("Parameter runId 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(this.client.subscriptionId(), resourceGroupName, registryName, runId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2019-04-01"; + return service.get(this.client.subscriptionId(), resourceGroupName, registryName, runId, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -508,13 +502,11 @@ public Observable> updateWithServiceResponseAsync(Stri if (runId == null) { throw new IllegalArgumentException("Parameter runId 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 apiVersion = "2019-04-01"; final Boolean isArchiveEnabled = null; RunUpdateParameters runUpdateParameters = new RunUpdateParameters(); runUpdateParameters.withIsArchiveEnabled(null); - Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, registryName, runId, this.client.apiVersion(), this.client.acceptLanguage(), runUpdateParameters, this.client.userAgent()); + Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, registryName, runId, apiVersion, this.client.acceptLanguage(), runUpdateParameters, this.client.userAgent()); return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); } /** @@ -590,12 +582,10 @@ public Observable> updateWithServiceResponseAsync(Stri if (runId == null) { throw new IllegalArgumentException("Parameter runId 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 apiVersion = "2019-04-01"; RunUpdateParameters runUpdateParameters = new RunUpdateParameters(); runUpdateParameters.withIsArchiveEnabled(isArchiveEnabled); - Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, registryName, runId, this.client.apiVersion(), this.client.acceptLanguage(), runUpdateParameters, this.client.userAgent()); + Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, registryName, runId, apiVersion, this.client.acceptLanguage(), runUpdateParameters, this.client.userAgent()); return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); } @@ -668,13 +658,11 @@ public Observable> beginUpdateWithServiceResponseAsync if (runId == null) { throw new IllegalArgumentException("Parameter runId 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 apiVersion = "2019-04-01"; final Boolean isArchiveEnabled = null; RunUpdateParameters runUpdateParameters = new RunUpdateParameters(); runUpdateParameters.withIsArchiveEnabled(null); - return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, registryName, runId, this.client.apiVersion(), this.client.acceptLanguage(), runUpdateParameters, this.client.userAgent()) + return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, registryName, runId, apiVersion, this.client.acceptLanguage(), runUpdateParameters, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -761,12 +749,10 @@ public Observable> beginUpdateWithServiceResponseAsync if (runId == null) { throw new IllegalArgumentException("Parameter runId 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 apiVersion = "2019-04-01"; RunUpdateParameters runUpdateParameters = new RunUpdateParameters(); runUpdateParameters.withIsArchiveEnabled(isArchiveEnabled); - return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, registryName, runId, this.client.apiVersion(), this.client.acceptLanguage(), runUpdateParameters, this.client.userAgent()) + return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, registryName, runId, apiVersion, this.client.acceptLanguage(), runUpdateParameters, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -857,10 +843,8 @@ public Observable> getLogSasUrlWithService if (runId == null) { throw new IllegalArgumentException("Parameter runId 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.getLogSasUrl(this.client.subscriptionId(), resourceGroupName, registryName, runId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2019-04-01"; + return service.getLogSasUrl(this.client.subscriptionId(), resourceGroupName, registryName, runId, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -949,10 +933,8 @@ public Observable> cancelWithServiceResponseAsync(String r if (runId == null) { throw new IllegalArgumentException("Parameter runId is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } - Observable> observable = service.cancel(this.client.subscriptionId(), resourceGroupName, registryName, runId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + final String apiVersion = "2019-04-01"; + Observable> observable = service.cancel(this.client.subscriptionId(), resourceGroupName, registryName, runId, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } @@ -1024,10 +1006,8 @@ public Observable> beginCancelWithServiceResponseAsync(Str if (runId == null) { throw new IllegalArgumentException("Parameter runId 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.beginCancel(this.client.subscriptionId(), resourceGroupName, registryName, runId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2019-04-01"; + return service.beginCancel(this.client.subscriptionId(), resourceGroupName, registryName, runId, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/TasksInner.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/TasksInner.java index 98c174a2d535..d62c1f65e8be 100644 --- a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/TasksInner.java +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/TasksInner.java @@ -205,10 +205,8 @@ public Observable>> listSinglePageAsync(final St if (registryName == null) { throw new IllegalArgumentException("Parameter registryName 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(), resourceGroupName, registryName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2019-04-01"; + return service.list(this.client.subscriptionId(), resourceGroupName, registryName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -298,10 +296,8 @@ public Observable> getWithServiceResponseAsync(String if (taskName == null) { throw new IllegalArgumentException("Parameter taskName 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(this.client.subscriptionId(), resourceGroupName, registryName, taskName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2019-04-01"; + return service.get(this.client.subscriptionId(), resourceGroupName, registryName, taskName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -395,14 +391,12 @@ public Observable> createWithServiceResponseAsync(Str if (taskName == null) { throw new IllegalArgumentException("Parameter taskName is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } if (taskCreateParameters == null) { throw new IllegalArgumentException("Parameter taskCreateParameters is required and cannot be null."); } Validator.validate(taskCreateParameters); - Observable> observable = service.create(this.client.subscriptionId(), resourceGroupName, registryName, taskName, this.client.apiVersion(), taskCreateParameters, this.client.acceptLanguage(), this.client.userAgent()); + final String apiVersion = "2019-04-01"; + Observable> observable = service.create(this.client.subscriptionId(), resourceGroupName, registryName, taskName, apiVersion, taskCreateParameters, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); } @@ -479,14 +473,12 @@ public Observable> beginCreateWithServiceResponseAsyn if (taskName == null) { throw new IllegalArgumentException("Parameter taskName is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } if (taskCreateParameters == null) { throw new IllegalArgumentException("Parameter taskCreateParameters is required and cannot be null."); } Validator.validate(taskCreateParameters); - return service.beginCreate(this.client.subscriptionId(), resourceGroupName, registryName, taskName, this.client.apiVersion(), taskCreateParameters, this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2019-04-01"; + return service.beginCreate(this.client.subscriptionId(), resourceGroupName, registryName, taskName, apiVersion, taskCreateParameters, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -576,10 +568,8 @@ public Observable> deleteWithServiceResponseAsync(String r if (taskName == null) { throw new IllegalArgumentException("Parameter taskName is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } - Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, registryName, taskName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + final String apiVersion = "2019-04-01"; + Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, registryName, taskName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } @@ -651,10 +641,8 @@ public Observable> beginDeleteWithServiceResponseAsync(Str if (taskName == null) { throw new IllegalArgumentException("Parameter taskName 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.beginDelete(this.client.subscriptionId(), resourceGroupName, registryName, taskName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2019-04-01"; + return service.beginDelete(this.client.subscriptionId(), resourceGroupName, registryName, taskName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -750,14 +738,12 @@ public Observable> updateWithServiceResponseAsync(Str if (taskName == null) { throw new IllegalArgumentException("Parameter taskName is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } if (taskUpdateParameters == null) { throw new IllegalArgumentException("Parameter taskUpdateParameters is required and cannot be null."); } Validator.validate(taskUpdateParameters); - Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, registryName, taskName, this.client.apiVersion(), taskUpdateParameters, this.client.acceptLanguage(), this.client.userAgent()); + final String apiVersion = "2019-04-01"; + Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, registryName, taskName, apiVersion, taskUpdateParameters, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); } @@ -834,14 +820,12 @@ public Observable> beginUpdateWithServiceResponseAsyn if (taskName == null) { throw new IllegalArgumentException("Parameter taskName is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } if (taskUpdateParameters == null) { throw new IllegalArgumentException("Parameter taskUpdateParameters is required and cannot be null."); } Validator.validate(taskUpdateParameters); - return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, registryName, taskName, this.client.apiVersion(), taskUpdateParameters, this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2019-04-01"; + return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, registryName, taskName, apiVersion, taskUpdateParameters, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -932,10 +916,8 @@ public Observable> getDetailsWithServiceResponseAsync if (taskName == null) { throw new IllegalArgumentException("Parameter taskName 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.getDetails(this.client.subscriptionId(), resourceGroupName, registryName, taskName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2019-04-01"; + return service.getDetails(this.client.subscriptionId(), resourceGroupName, registryName, taskName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/WebhookImpl.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/WebhookImpl.java new file mode 100644 index 000000000000..f520ea0da6f0 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/WebhookImpl.java @@ -0,0 +1,222 @@ +/** + * 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.containerregistry.v2019_04_01.implementation; + +import com.microsoft.azure.management.containerregistry.v2019_04_01.Webhook; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.containerregistry.v2019_04_01.WebhookUpdateParameters; +import java.util.Map; +import java.util.List; +import com.microsoft.azure.management.containerregistry.v2019_04_01.WebhookCreateParameters; +import com.microsoft.azure.management.containerregistry.v2019_04_01.WebhookAction; +import com.microsoft.azure.management.containerregistry.v2019_04_01.ProvisioningState; +import com.microsoft.azure.management.containerregistry.v2019_04_01.WebhookStatus; +import rx.functions.Func1; + +class WebhookImpl extends CreatableUpdatableImpl implements Webhook, Webhook.Definition, Webhook.Update { + private final ContainerRegistryManager manager; + private String resourceGroupName; + private String registryName; + private String webhookName; + private WebhookCreateParameters createParameter; + private WebhookUpdateParameters updateParameter; + + WebhookImpl(String name, ContainerRegistryManager manager) { + super(name, new WebhookInner()); + this.manager = manager; + // Set resource name + this.webhookName = name; + // + this.createParameter = new WebhookCreateParameters(); + this.updateParameter = new WebhookUpdateParameters(); + } + + WebhookImpl(WebhookInner inner, ContainerRegistryManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.webhookName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.registryName = IdParsingUtils.getValueFromIdByName(inner.id(), "registries"); + this.webhookName = IdParsingUtils.getValueFromIdByName(inner.id(), "webhooks"); + // + this.createParameter = new WebhookCreateParameters(); + this.updateParameter = new WebhookUpdateParameters(); + } + + @Override + public ContainerRegistryManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + WebhooksInner client = this.manager().inner().webhooks(); + return client.createAsync(this.resourceGroupName, this.registryName, this.webhookName, this.createParameter) + .map(new Func1() { + @Override + public WebhookInner call(WebhookInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + WebhooksInner client = this.manager().inner().webhooks(); + return client.updateAsync(this.resourceGroupName, this.registryName, this.webhookName, this.updateParameter) + .map(new Func1() { + @Override + public WebhookInner call(WebhookInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + WebhooksInner client = this.manager().inner().webhooks(); + return client.getAsync(this.resourceGroupName, this.registryName, this.webhookName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createParameter = new WebhookCreateParameters(); + this.updateParameter = new WebhookUpdateParameters(); + } + + @Override + public List actions() { + return this.inner().actions(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public String scope() { + return this.inner().scope(); + } + + @Override + public WebhookStatus status() { + return this.inner().status(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public WebhookImpl withExistingRegistry(String resourceGroupName, String registryName) { + this.resourceGroupName = resourceGroupName; + this.registryName = registryName; + return this; + } + + @Override + public WebhookImpl withLocation(String location) { + this.createParameter.withLocation(location); + return this; + } + + @Override + public WebhookImpl withActions(List actions) { + if (isInCreateMode()) { + this.createParameter.withActions(actions); + } else { + this.updateParameter.withActions(actions); + } + return this; + } + + @Override + public WebhookImpl withServiceUri(String serviceUri) { + if (isInCreateMode()) { + this.createParameter.withServiceUri(serviceUri); + } else { + this.updateParameter.withServiceUri(serviceUri); + } + return this; + } + + @Override + public WebhookImpl withCustomHeaders(Map customHeaders) { + if (isInCreateMode()) { + this.createParameter.withCustomHeaders(customHeaders); + } else { + this.updateParameter.withCustomHeaders(customHeaders); + } + return this; + } + + @Override + public WebhookImpl withScope(String scope) { + if (isInCreateMode()) { + this.createParameter.withScope(scope); + } else { + this.updateParameter.withScope(scope); + } + return this; + } + + @Override + public WebhookImpl withStatus(WebhookStatus status) { + if (isInCreateMode()) { + this.createParameter.withStatus(status); + } else { + this.updateParameter.withStatus(status); + } + return this; + } + + @Override + public WebhookImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createParameter.withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/WebhookInner.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/WebhookInner.java new file mode 100644 index 000000000000..1cf1135f6823 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/WebhookInner.java @@ -0,0 +1,123 @@ +/** + * 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.containerregistry.v2019_04_01.implementation; + +import com.microsoft.azure.management.containerregistry.v2019_04_01.WebhookStatus; +import java.util.List; +import com.microsoft.azure.management.containerregistry.v2019_04_01.WebhookAction; +import com.microsoft.azure.management.containerregistry.v2019_04_01.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An object that represents a webhook for a container registry. + */ +@JsonFlatten +public class WebhookInner extends Resource { + /** + * The status of the webhook at the time the operation was called. Possible + * values include: 'enabled', 'disabled'. + */ + @JsonProperty(value = "properties.status") + private WebhookStatus status; + + /** + * The scope of repositories where the event can be triggered. For example, + * 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' + * means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. + * Empty means all events. + */ + @JsonProperty(value = "properties.scope") + private String scope; + + /** + * The list of actions that trigger the webhook to post notifications. + */ + @JsonProperty(value = "properties.actions", required = true) + private List actions; + + /** + * The provisioning state of the webhook at the time the operation was + * called. Possible values include: 'Creating', 'Updating', 'Deleting', + * 'Succeeded', 'Failed', 'Canceled'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the status of the webhook at the time the operation was called. Possible values include: 'enabled', 'disabled'. + * + * @return the status value + */ + public WebhookStatus status() { + return this.status; + } + + /** + * Set the status of the webhook at the time the operation was called. Possible values include: 'enabled', 'disabled'. + * + * @param status the status value to set + * @return the WebhookInner object itself. + */ + public WebhookInner withStatus(WebhookStatus status) { + this.status = status; + return this; + } + + /** + * Get the scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @return the scope value + */ + public String scope() { + return this.scope; + } + + /** + * Set the scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + * + * @param scope the scope value to set + * @return the WebhookInner object itself. + */ + public WebhookInner withScope(String scope) { + this.scope = scope; + return this; + } + + /** + * Get the list of actions that trigger the webhook to post notifications. + * + * @return the actions value + */ + public List actions() { + return this.actions; + } + + /** + * Set the list of actions that trigger the webhook to post notifications. + * + * @param actions the actions value to set + * @return the WebhookInner object itself. + */ + public WebhookInner withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Get the provisioning state of the webhook at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/WebhooksImpl.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/WebhooksImpl.java new file mode 100644 index 000000000000..7dd5811ba1da --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/WebhooksImpl.java @@ -0,0 +1,126 @@ +/** + * 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.containerregistry.v2019_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.containerregistry.v2019_04_01.Webhooks; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.containerregistry.v2019_04_01.EventInfo; +import com.microsoft.azure.management.containerregistry.v2019_04_01.CallbackConfig; +import com.microsoft.azure.management.containerregistry.v2019_04_01.Event; +import com.microsoft.azure.management.containerregistry.v2019_04_01.Webhook; + +class WebhooksImpl extends WrapperImpl implements Webhooks { + private final ContainerRegistryManager manager; + + WebhooksImpl(ContainerRegistryManager manager) { + super(manager.inner().webhooks()); + this.manager = manager; + } + + public ContainerRegistryManager manager() { + return this.manager; + } + + @Override + public WebhookImpl define(String name) { + return wrapModel(name); + } + + private WebhookImpl wrapModel(WebhookInner inner) { + return new WebhookImpl(inner, manager()); + } + + private WebhookImpl wrapModel(String name) { + return new WebhookImpl(name, this.manager()); + } + + @Override + public Observable pingAsync(String resourceGroupName, String registryName, String webhookName) { + WebhooksInner client = this.inner(); + return client.pingAsync(resourceGroupName, registryName, webhookName) + .map(new Func1() { + @Override + public EventInfo call(EventInfoInner inner) { + return new EventInfoImpl(inner, manager()); + } + }); + } + + @Override + public Observable getCallbackConfigAsync(String resourceGroupName, String registryName, String webhookName) { + WebhooksInner client = this.inner(); + return client.getCallbackConfigAsync(resourceGroupName, registryName, webhookName) + .map(new Func1() { + @Override + public CallbackConfig call(CallbackConfigInner inner) { + return new CallbackConfigImpl(inner, manager()); + } + }); + } + + @Override + public Observable listEventsAsync(final String resourceGroupName, final String registryName, final String webhookName) { + WebhooksInner client = this.inner(); + return client.listEventsAsync(resourceGroupName, registryName, webhookName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Event call(EventInner inner) { + return new EventImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String registryName) { + WebhooksInner client = this.inner(); + return client.listAsync(resourceGroupName, registryName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Webhook call(WebhookInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String registryName, String webhookName) { + WebhooksInner client = this.inner(); + return client.getAsync(resourceGroupName, registryName, webhookName) + .map(new Func1() { + @Override + public Webhook call(WebhookInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String registryName, String webhookName) { + WebhooksInner client = this.inner(); + return client.deleteAsync(resourceGroupName, registryName, webhookName).toCompletable(); + } + +} diff --git a/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/WebhooksInner.java b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/WebhooksInner.java new file mode 100644 index 000000000000..fda49f767f65 --- /dev/null +++ b/containerregistry/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/containerregistry/v2019_04_01/implementation/WebhooksInner.java @@ -0,0 +1,1396 @@ +/** + * 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.containerregistry.v2019_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.containerregistry.v2019_04_01.WebhookCreateParameters; +import com.microsoft.azure.management.containerregistry.v2019_04_01.WebhookUpdateParameters; +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.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +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 Webhooks. + */ +public class WebhooksInner { + /** The Retrofit service to perform REST calls. */ + private WebhooksService service; + /** The service client containing this operation class. */ + private ContainerRegistryManagementClientImpl client; + + /** + * Initializes an instance of WebhooksInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public WebhooksInner(Retrofit retrofit, ContainerRegistryManagementClientImpl client) { + this.service = retrofit.create(WebhooksService.class); + this.client = client; + } + + /** + * The interface defining all the services for Webhooks to be + * used by Retrofit to perform actually REST calls. + */ + interface WebhooksService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerregistry.v2019_04_01.Webhooks get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("webhookName") String webhookName, @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.containerregistry.v2019_04_01.Webhooks create" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}") + Observable> create(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("webhookName") String webhookName, @Query("api-version") String apiVersion, @Body WebhookCreateParameters webhookCreateParameters, @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.containerregistry.v2019_04_01.Webhooks beginCreate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}") + Observable> beginCreate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("webhookName") String webhookName, @Query("api-version") String apiVersion, @Body WebhookCreateParameters webhookCreateParameters, @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.containerregistry.v2019_04_01.Webhooks delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("webhookName") String webhookName, @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.containerregistry.v2019_04_01.Webhooks beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("webhookName") String webhookName, @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.containerregistry.v2019_04_01.Webhooks update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("webhookName") String webhookName, @Query("api-version") String apiVersion, @Body WebhookUpdateParameters webhookUpdateParameters, @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.containerregistry.v2019_04_01.Webhooks beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}") + Observable> beginUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("webhookName") String webhookName, @Query("api-version") String apiVersion, @Body WebhookUpdateParameters webhookUpdateParameters, @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.containerregistry.v2019_04_01.Webhooks list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @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.containerregistry.v2019_04_01.Webhooks ping" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping") + Observable> ping(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("webhookName") String webhookName, @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.containerregistry.v2019_04_01.Webhooks getCallbackConfig" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig") + Observable> getCallbackConfig(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("webhookName") String webhookName, @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.containerregistry.v2019_04_01.Webhooks listEvents" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents") + Observable> listEvents(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("registryName") String registryName, @Path("webhookName") String webhookName, @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.containerregistry.v2019_04_01.Webhooks listNext" }) + @GET + Observable> listNext(@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.containerregistry.v2019_04_01.Webhooks listEventsNext" }) + @GET + Observable> listEventsNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the properties of the specified webhook. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the WebhookInner object if successful. + */ + public WebhookInner get(String resourceGroupName, String registryName, String webhookName) { + return getWithServiceResponseAsync(resourceGroupName, registryName, webhookName).toBlocking().single().body(); + } + + /** + * Gets the properties of the specified webhook. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @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 registryName, String webhookName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, registryName, webhookName), serviceCallback); + } + + /** + * Gets the properties of the specified webhook. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WebhookInner object + */ + public Observable getAsync(String resourceGroupName, String registryName, String webhookName) { + return getWithServiceResponseAsync(resourceGroupName, registryName, webhookName).map(new Func1, WebhookInner>() { + @Override + public WebhookInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the properties of the specified webhook. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WebhookInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String registryName, String webhookName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (webhookName == null) { + throw new IllegalArgumentException("Parameter webhookName is required and cannot be null."); + } + final String apiVersion = "2017-10-01"; + return service.get(this.client.subscriptionId(), resourceGroupName, registryName, webhookName, 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates a webhook for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @param webhookCreateParameters The parameters for creating a webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the WebhookInner object if successful. + */ + public WebhookInner create(String resourceGroupName, String registryName, String webhookName, WebhookCreateParameters webhookCreateParameters) { + return createWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookCreateParameters).toBlocking().last().body(); + } + + /** + * Creates a webhook for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @param webhookCreateParameters The parameters for creating a webhook. + * @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 createAsync(String resourceGroupName, String registryName, String webhookName, WebhookCreateParameters webhookCreateParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookCreateParameters), serviceCallback); + } + + /** + * Creates a webhook for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @param webhookCreateParameters The parameters for creating a webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String registryName, String webhookName, WebhookCreateParameters webhookCreateParameters) { + return createWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookCreateParameters).map(new Func1, WebhookInner>() { + @Override + public WebhookInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a webhook for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @param webhookCreateParameters The parameters for creating a webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String registryName, String webhookName, WebhookCreateParameters webhookCreateParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (webhookName == null) { + throw new IllegalArgumentException("Parameter webhookName is required and cannot be null."); + } + if (webhookCreateParameters == null) { + throw new IllegalArgumentException("Parameter webhookCreateParameters is required and cannot be null."); + } + Validator.validate(webhookCreateParameters); + final String apiVersion = "2017-10-01"; + Observable> observable = service.create(this.client.subscriptionId(), resourceGroupName, registryName, webhookName, apiVersion, webhookCreateParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a webhook for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @param webhookCreateParameters The parameters for creating a webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the WebhookInner object if successful. + */ + public WebhookInner beginCreate(String resourceGroupName, String registryName, String webhookName, WebhookCreateParameters webhookCreateParameters) { + return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookCreateParameters).toBlocking().single().body(); + } + + /** + * Creates a webhook for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @param webhookCreateParameters The parameters for creating a webhook. + * @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 beginCreateAsync(String resourceGroupName, String registryName, String webhookName, WebhookCreateParameters webhookCreateParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookCreateParameters), serviceCallback); + } + + /** + * Creates a webhook for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @param webhookCreateParameters The parameters for creating a webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WebhookInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String registryName, String webhookName, WebhookCreateParameters webhookCreateParameters) { + return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookCreateParameters).map(new Func1, WebhookInner>() { + @Override + public WebhookInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a webhook for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @param webhookCreateParameters The parameters for creating a webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WebhookInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String registryName, String webhookName, WebhookCreateParameters webhookCreateParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (webhookName == null) { + throw new IllegalArgumentException("Parameter webhookName is required and cannot be null."); + } + if (webhookCreateParameters == null) { + throw new IllegalArgumentException("Parameter webhookCreateParameters is required and cannot be null."); + } + Validator.validate(webhookCreateParameters); + final String apiVersion = "2017-10-01"; + return service.beginCreate(this.client.subscriptionId(), resourceGroupName, registryName, webhookName, apiVersion, webhookCreateParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a webhook from a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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 registryName, String webhookName) { + deleteWithServiceResponseAsync(resourceGroupName, registryName, webhookName).toBlocking().last().body(); + } + + /** + * Deletes a webhook from a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @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 registryName, String webhookName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, registryName, webhookName), serviceCallback); + } + + /** + * Deletes a webhook from a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String registryName, String webhookName) { + return deleteWithServiceResponseAsync(resourceGroupName, registryName, webhookName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a webhook from a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String registryName, String webhookName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (webhookName == null) { + throw new IllegalArgumentException("Parameter webhookName is required and cannot be null."); + } + final String apiVersion = "2017-10-01"; + Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, registryName, webhookName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a webhook from a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String registryName, String webhookName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, registryName, webhookName).toBlocking().single().body(); + } + + /** + * Deletes a webhook from a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @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 beginDeleteAsync(String resourceGroupName, String registryName, String webhookName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, registryName, webhookName), serviceCallback); + } + + /** + * Deletes a webhook from a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String registryName, String webhookName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, registryName, webhookName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a webhook from a container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String registryName, String webhookName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (webhookName == null) { + throw new IllegalArgumentException("Parameter webhookName is required and cannot be null."); + } + final String apiVersion = "2017-10-01"; + return service.beginDelete(this.client.subscriptionId(), resourceGroupName, registryName, webhookName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates a webhook with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @param webhookUpdateParameters The parameters for updating a webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the WebhookInner object if successful. + */ + public WebhookInner update(String resourceGroupName, String registryName, String webhookName, WebhookUpdateParameters webhookUpdateParameters) { + return updateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookUpdateParameters).toBlocking().last().body(); + } + + /** + * Updates a webhook with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @param webhookUpdateParameters The parameters for updating a webhook. + * @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 registryName, String webhookName, WebhookUpdateParameters webhookUpdateParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookUpdateParameters), serviceCallback); + } + + /** + * Updates a webhook with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @param webhookUpdateParameters The parameters for updating a webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String registryName, String webhookName, WebhookUpdateParameters webhookUpdateParameters) { + return updateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookUpdateParameters).map(new Func1, WebhookInner>() { + @Override + public WebhookInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a webhook with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @param webhookUpdateParameters The parameters for updating a webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String registryName, String webhookName, WebhookUpdateParameters webhookUpdateParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (webhookName == null) { + throw new IllegalArgumentException("Parameter webhookName is required and cannot be null."); + } + if (webhookUpdateParameters == null) { + throw new IllegalArgumentException("Parameter webhookUpdateParameters is required and cannot be null."); + } + Validator.validate(webhookUpdateParameters); + final String apiVersion = "2017-10-01"; + Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, registryName, webhookName, apiVersion, webhookUpdateParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a webhook with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @param webhookUpdateParameters The parameters for updating a webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the WebhookInner object if successful. + */ + public WebhookInner beginUpdate(String resourceGroupName, String registryName, String webhookName, WebhookUpdateParameters webhookUpdateParameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookUpdateParameters).toBlocking().single().body(); + } + + /** + * Updates a webhook with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @param webhookUpdateParameters The parameters for updating a webhook. + * @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 beginUpdateAsync(String resourceGroupName, String registryName, String webhookName, WebhookUpdateParameters webhookUpdateParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookUpdateParameters), serviceCallback); + } + + /** + * Updates a webhook with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @param webhookUpdateParameters The parameters for updating a webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WebhookInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String registryName, String webhookName, WebhookUpdateParameters webhookUpdateParameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookUpdateParameters).map(new Func1, WebhookInner>() { + @Override + public WebhookInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a webhook with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @param webhookUpdateParameters The parameters for updating a webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WebhookInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String registryName, String webhookName, WebhookUpdateParameters webhookUpdateParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (webhookName == null) { + throw new IllegalArgumentException("Parameter webhookName is required and cannot be null."); + } + if (webhookUpdateParameters == null) { + throw new IllegalArgumentException("Parameter webhookUpdateParameters is required and cannot be null."); + } + Validator.validate(webhookUpdateParameters); + final String apiVersion = "2017-10-01"; + return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, registryName, webhookName, apiVersion, webhookUpdateParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all the webhooks for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<WebhookInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String registryName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, registryName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all the webhooks for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @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 resourceGroupName, final String registryName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, registryName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all the webhooks for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<WebhookInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String registryName) { + return listWithServiceResponseAsync(resourceGroupName, registryName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the webhooks for the specified container registry. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<WebhookInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String registryName) { + return listSinglePageAsync(resourceGroupName, registryName) + .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 the webhooks for the specified container registry. + * + ServiceResponse> * @param resourceGroupName The name of the resource group to which the container registry belongs. + ServiceResponse> * @param registryName The name of the container registry. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<WebhookInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String registryName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + final String apiVersion = "2017-10-01"; + return service.list(this.client.subscriptionId(), resourceGroupName, registryName, 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Triggers a ping event to be sent to the webhook. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EventInfoInner object if successful. + */ + public EventInfoInner ping(String resourceGroupName, String registryName, String webhookName) { + return pingWithServiceResponseAsync(resourceGroupName, registryName, webhookName).toBlocking().single().body(); + } + + /** + * Triggers a ping event to be sent to the webhook. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @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 pingAsync(String resourceGroupName, String registryName, String webhookName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(pingWithServiceResponseAsync(resourceGroupName, registryName, webhookName), serviceCallback); + } + + /** + * Triggers a ping event to be sent to the webhook. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EventInfoInner object + */ + public Observable pingAsync(String resourceGroupName, String registryName, String webhookName) { + return pingWithServiceResponseAsync(resourceGroupName, registryName, webhookName).map(new Func1, EventInfoInner>() { + @Override + public EventInfoInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Triggers a ping event to be sent to the webhook. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EventInfoInner object + */ + public Observable> pingWithServiceResponseAsync(String resourceGroupName, String registryName, String webhookName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (webhookName == null) { + throw new IllegalArgumentException("Parameter webhookName is required and cannot be null."); + } + final String apiVersion = "2017-10-01"; + return service.ping(this.client.subscriptionId(), resourceGroupName, registryName, webhookName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = pingDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse pingDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the configuration of service URI and custom headers for the webhook. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CallbackConfigInner object if successful. + */ + public CallbackConfigInner getCallbackConfig(String resourceGroupName, String registryName, String webhookName) { + return getCallbackConfigWithServiceResponseAsync(resourceGroupName, registryName, webhookName).toBlocking().single().body(); + } + + /** + * Gets the configuration of service URI and custom headers for the webhook. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @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 getCallbackConfigAsync(String resourceGroupName, String registryName, String webhookName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getCallbackConfigWithServiceResponseAsync(resourceGroupName, registryName, webhookName), serviceCallback); + } + + /** + * Gets the configuration of service URI and custom headers for the webhook. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CallbackConfigInner object + */ + public Observable getCallbackConfigAsync(String resourceGroupName, String registryName, String webhookName) { + return getCallbackConfigWithServiceResponseAsync(resourceGroupName, registryName, webhookName).map(new Func1, CallbackConfigInner>() { + @Override + public CallbackConfigInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the configuration of service URI and custom headers for the webhook. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CallbackConfigInner object + */ + public Observable> getCallbackConfigWithServiceResponseAsync(String resourceGroupName, String registryName, String webhookName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (webhookName == null) { + throw new IllegalArgumentException("Parameter webhookName is required and cannot be null."); + } + final String apiVersion = "2017-10-01"; + return service.getCallbackConfig(this.client.subscriptionId(), resourceGroupName, registryName, webhookName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getCallbackConfigDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getCallbackConfigDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists recent events for the specified webhook. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<EventInner> object if successful. + */ + public PagedList listEvents(final String resourceGroupName, final String registryName, final String webhookName) { + ServiceResponse> response = listEventsSinglePageAsync(resourceGroupName, registryName, webhookName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listEventsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists recent events for the specified webhook. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @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> listEventsAsync(final String resourceGroupName, final String registryName, final String webhookName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listEventsSinglePageAsync(resourceGroupName, registryName, webhookName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listEventsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists recent events for the specified webhook. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventInner> object + */ + public Observable> listEventsAsync(final String resourceGroupName, final String registryName, final String webhookName) { + return listEventsWithServiceResponseAsync(resourceGroupName, registryName, webhookName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists recent events for the specified webhook. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param registryName The name of the container registry. + * @param webhookName The name of the webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventInner> object + */ + public Observable>> listEventsWithServiceResponseAsync(final String resourceGroupName, final String registryName, final String webhookName) { + return listEventsSinglePageAsync(resourceGroupName, registryName, webhookName) + .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(listEventsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists recent events for the specified webhook. + * + ServiceResponse> * @param resourceGroupName The name of the resource group to which the container registry belongs. + ServiceResponse> * @param registryName The name of the container registry. + ServiceResponse> * @param webhookName The name of the webhook. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EventInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listEventsSinglePageAsync(final String resourceGroupName, final String registryName, final String webhookName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (registryName == null) { + throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); + } + if (webhookName == null) { + throw new IllegalArgumentException("Parameter webhookName is required and cannot be null."); + } + final String apiVersion = "2017-10-01"; + return service.listEvents(this.client.subscriptionId(), resourceGroupName, registryName, webhookName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listEventsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listEventsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all the webhooks for the specified container registry. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<WebhookInner> 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 the webhooks for the specified container registry. + * + * @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 the webhooks for the specified container registry. + * + * @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<WebhookInner> 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 the webhooks for the specified container registry. + * + * @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<WebhookInner> 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 the webhooks for the specified container registry. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<WebhookInner> 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists recent events for the specified webhook. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<EventInner> object if successful. + */ + public PagedList listEventsNext(final String nextPageLink) { + ServiceResponse> response = listEventsNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listEventsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists recent events for the specified webhook. + * + * @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> listEventsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listEventsNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listEventsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists recent events for the specified webhook. + * + * @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<EventInner> object + */ + public Observable> listEventsNextAsync(final String nextPageLink) { + return listEventsNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists recent events for the specified webhook. + * + * @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<EventInner> object + */ + public Observable>> listEventsNextWithServiceResponseAsync(final String nextPageLink) { + return listEventsNextSinglePageAsync(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(listEventsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists recent events for the specified webhook. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EventInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listEventsNextSinglePageAsync(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.listEventsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listEventsNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listEventsNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyClientJavaDocCodeSnippets.java index c2e2caedfee1..8d15a0f13656 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyClientJavaDocCodeSnippets.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyClientJavaDocCodeSnippets.java @@ -4,10 +4,6 @@ package com.azure.security.keyvault.keys; import com.azure.core.credentials.TokenCredential; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.VoidResponse; import com.azure.core.util.Context; diff --git a/storage/client/blob/CHANGELOG.md b/storage/client/blob/CHANGELOG.md index 32e9b8a3e4a4..27a9660550d7 100644 --- a/storage/client/blob/CHANGELOG.md +++ b/storage/client/blob/CHANGELOG.md @@ -7,7 +7,7 @@ https://aka.ms/azure-sdk-preview1-java. **Breaking changes: New API design** - Operations are now scoped to a particular client: - - `StorageClient`: StorageURL's functionality was migrated to StorageClient. This client handles account-level operations. This includes managing service properties and listing the containers within an account. + - `BlobServiceClient`: StorageURL's functionality was migrated to BlobServiceClient. This client handles account-level operations. This includes managing service properties and listing the containers within an account. - `ContainerClient`: ContainerURL's functionality was migrated to ContainerClient. The client handles operations for a particular container. This includes creating or deleting that container, as well as listing the blobs within that container. - `BlobClient`: BlobURL's functionality was migrated to BlobClient, TransferManager download functionality was migrated to BlobClient and TransferManager upload functionality was migrated to BlockBlobClient. The client handles most operations, excluding upload, for an individual blob, including downloading data and working with blob properties. There are subclients (BlockBlobClient, PageBlobClient, AppendBlobClient) available for their respective blob types on the service. diff --git a/storage/client/blob/README.md b/storage/client/blob/README.md index 5a90220c5ed7..a819bc1e98ba 100644 --- a/storage/client/blob/README.md +++ b/storage/client/blob/README.md @@ -97,9 +97,9 @@ Blob storage is designed for: The following sections provide several code snippets covering some of the most common Azure Storage Blob tasks, including: -- [Create storage client](#create-storage-client) -- [Create container client](#create-container-client) -- [Create blob client](#create-blob-client) +- [Create BlobServiceClient](#create-blobserviceclient) +- [Create ContainerClient](#create-containerclient) +- [Create BlobClient](#create-blobclient) - [Create a container](#create-a-container) - [Upload a blob from InputStream](#uploading-a-blob-from-a-stream) - [Upload a blob from File](#uploading-a-blob-from-file) @@ -108,70 +108,70 @@ The following sections provide several code snippets covering some of the most c - [Enumerating blobs](#enumerating-blobs) - [Authenticate with Azure.Identity](#authenticate-with-azureidentity) -### Create storage client +### Create BlobServiceClient -Create a storage client using the [`sasToken`](#get-credentials) generated above. +Create a BlobServiceClient using the [`sasToken`](#get-credentials) generated above. ```java -StorageClient storageClient = StorageClient.builder() +BlobServiceClient blobServiceClient = new BlobServiceClientBuilder() .endpoint("") .credential("") - .build(); + .buildClient(); ``` -### Create container client +### Create ContainerClient -Create a container client if storage client exists. +Create a ContainerClient if a BlobServiceClient exists. ```java -ContainerClient containerClient = storageClient.getContainerClient("mycontainer"); +ContainerClient containerClient = blobServiceClient.getContainerClient("mycontainer"); ``` or -Create the container client from the builder [`sasToken`](#get-credentials) generated above. +Create the ContainerClient from the builder [`sasToken`](#get-credentials) generated above. ```java -ContainerClient containerClient = ContainerClient.builder() +ContainerClient containerClient = new ContainerClientBuilder() .endpoint("") .credential("") .containerName("mycontainer") - .build(); + .buildClient(); ``` -### Create blob client +### Create BlobClient -Create a blob client if container client exists. +Create a BlobClient if container client exists. ```java BlobClient blobClient = containerClient.getBlobClient("myblob"); ``` or -Create the blob client from the builder [`sasToken`](#get-credentials) generated above. +Create the BlobClient from the builder [`sasToken`](#get-credentials) generated above. ```java -BlobClient blobClient = BlobClient.builder() +BlobClient blobClient = new BlobClientBuilder() .endpoint("") .credential("") .containerName("mycontainer") .blobName("myblob") - .build(); + .buildBlobClient(); ``` ### Create a container -Create a container from storage client. +Create a container from a BlobServiceClient. ```java -storageClient.createContainer("mycontainer"); +blobServiceClient.createContainer("mycontainer"); ``` or -Create a container using container client. +Create a container using ContainerClient. ```java containerClient.create(); ``` ### Uploading a blob from a stream -Upload data stream to a blob using blockBlobClient generated from containerClient. +Upload data stream to a blob using BlockBlobClient generated from a ContainerClient. ```java BlockBlobClient blockBlobClient = containerClient.getBlockBlobClient("myblockblob"); @@ -183,7 +183,7 @@ try (ByteArrayInputStream dataStream = new ByteArrayInputStream(dataSample.getBy ### Uploading a blob from `File` -Upload a file to a blob using blockBlobClient generated from containerClient. +Upload a file to a blob using BlockBlobClient generated from ContainerClient. ```java BlockBlobClient blockBlobClient = containerClient.getBlockBlobClient("myblockblob"); @@ -192,7 +192,7 @@ blobClient.uploadFromFile("local-file.jpg"); ### Downloading a blob to output stream -Download blob to output stream using blobClient. +Download blob to output stream using BlobClient. ```java try(ByteArrayOutputStream outputStream = new ByteArrayOutputStream("downloaded-file.jpg")) { @@ -202,14 +202,14 @@ try(ByteArrayOutputStream outputStream = new ByteArrayOutputStream("downloaded-f ### Downloading a blob to local path -Download blob to local file using blobClient. +Download blob to local file using BlobClient. ```java blobClient.downloadToFile("downloaded-file.jpg"); ``` ### Enumerating blobs -Enumerating all blobs using `ContainerClient` +Enumerating all blobs using ContainerClient ```java containerClient.listBlobsFlat() .forEach( @@ -222,7 +222,7 @@ containerClient.listBlobsFlat() The [Azure Identity library][identity] provides Azure Active Directory support for authenticating with Azure Storage. ```java -StorageClient storageClient = StorageClient.storageClientBuilder() +BlobServiceClient storageClient = BlobServiceClient.storageClientBuilder() .endpoint(endpoint) .credential(new DefaultAzureCredential()) .buildClient(); diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/AnonymousCredentialPolicy.java b/storage/client/blob/src/main/java/com/azure/storage/blob/AnonymousCredentialPolicy.java index d54b264702f6..d5b1b30df030 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/AnonymousCredentialPolicy.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/AnonymousCredentialPolicy.java @@ -13,7 +13,7 @@ * Anonymous credentials are to be used with with HTTP(S) requests that read blobs from public containers or requests * that use a Shared Access Signature (SAS). This is because Anonymous credentials will not set an Authorization header. * Pass an instance of this class as the credentials parameter when creating a new pipeline (typically with - * {@link StorageClient}). + * {@link BlobServiceClient}). */ public final class AnonymousCredentialPolicy implements HttpPipelinePolicy { diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java index 7275f0fb326f..af64a840c8cc 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java @@ -32,7 +32,7 @@ * *

* This client contains operations on a blob. Operations on a container are available on {@link ContainerAsyncClient}, - * and operations on the service are available on {@link StorageAsyncClient}. + * and operations on the service are available on {@link BlobServiceAsyncClient}. * *

* Please refer diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/AppendBlobClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/AppendBlobClient.java index 246fe645af17..65468a2e42b5 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/AppendBlobClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/AppendBlobClient.java @@ -31,7 +31,7 @@ * *

* This client contains operations on a blob. Operations on a container are available on {@link ContainerClient}, - * and operations on the service are available on {@link StorageClient}. + * and operations on the service are available on {@link BlobServiceClient}. * *

* Please refer to the Azure Docs diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java index 1e5f741d3b8a..ad598f8a8983 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java @@ -59,7 +59,7 @@ * *

* This client contains operations on a blob. Operations on a container are available on {@link ContainerAsyncClient}, - * and operations on the service are available on {@link StorageAsyncClient}. + * and operations on the service are available on {@link BlobServiceAsyncClient}. * *

* Please refer to the Azure @@ -71,7 +71,6 @@ * operation, until {@code .subscribe()} is called on the reactive response. You can simply convert one of these * responses to a {@link java.util.concurrent.CompletableFuture} object through {@link Mono#toFuture()}. */ -@SuppressWarnings({"unused", "WeakerAccess"}) public class BlobAsyncClient { private static final int BLOB_DEFAULT_DOWNLOAD_BLOCK_SIZE = 4 * Constants.MB; private static final int BLOB_MAX_DOWNLOAD_BLOCK_SIZE = 100 * Constants.MB; @@ -127,7 +126,7 @@ public PageBlobAsyncClient asPageBlobAsyncClient() { /** * Initializes a {@link ContainerAsyncClient} object pointing to the container this blob is in. This method does not - * create a container. It simply constructs the URL to the container and offers access to methods relevant to + * create a container. It simply constructs the client to the container and offers access to methods relevant to * containers. * * @return A {@link ContainerAsyncClient} object pointing to the container containing the blob @@ -158,7 +157,11 @@ public URL getBlobUrl() { } /** - * Gets if the blob this client represents exists in the cloud. + * Determines if the blob this client represents exists in the cloud. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.exists} * * @return true if the blob exists, false if it doesn't */ @@ -172,8 +175,14 @@ public Mono> exists() { } /** - * Copies the data at the source URL to a blob. For more information, see the - * Azure Docs + * Copies the data at the source URL to a blob. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL} + * + *

For more information, see the + * Azure Docs

* * @param sourceURL The source URL to copy from. URLs outside of Azure may only be copied to block blobs. * @return A reactive response containing the copy ID for the long running operation. @@ -183,8 +192,14 @@ public Mono> startCopyFromURL(URL sourceURL) { } /** - * Copies the data at the source URL to a blob. For more information, see the - * Azure Docs + * Copies the data at the source URL to a blob. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions} + * + *

For more information, see the + * Azure Docs

* * @param sourceURL The source URL to copy from. URLs outside of Azure may only be copied to block blobs. * @param metadata {@link Metadata} @@ -217,6 +232,13 @@ public Mono> startCopyFromURL(URL sourceURL, Metadata metadata, /** * Stops a pending copy that was previously started and leaves a destination blob with 0 length and metadata. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.abortCopyFromURL#String} + * + *

For more information, see the + * Azure Docs

+ * * @param copyId The id of the copy operation to abort. Returned as the {@code copyId} field on the {@link * BlobStartCopyFromURLHeaders} object. * @return A reactive response signalling completion. @@ -228,6 +250,13 @@ public Mono abortCopyFromURL(String copyId) { /** * Stops a pending copy that was previously started and leaves a destination blob with 0 length and metadata. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.abortCopyFromURL#String-LeaseAccessConditions} + * + *

For more information, see the + * Azure Docs

+ * * @param copyId The id of the copy operation to abort. Returned as the {@code copyId} field on the {@link * BlobStartCopyFromURLHeaders} object. * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does @@ -243,6 +272,13 @@ public Mono abortCopyFromURL(String copyId, LeaseAccessConditions /** * Copies the data at the source URL to a blob and waits for the copy to complete before returning a response. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL} + * + *

For more information, see the + * Azure Docs

+ * * @param copySource The source URL to copy from. * @return A reactive response containing the copy ID for the long running operation. */ @@ -253,6 +289,13 @@ public Mono> copyFromURL(URL copySource) { /** * Copies the data at the source URL to a blob and waits for the copy to complete before returning a response. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions} + * + *

For more information, see the + * Azure Docs

+ * * @param copySource The source URL to copy from. URLs outside of Azure may only be copied to block blobs. * @param metadata {@link Metadata} * @param sourceModifiedAccessConditions {@link ModifiedAccessConditions} against the source. Standard HTTP Access @@ -285,23 +328,37 @@ public Mono> copyFromURL(URL copySource, Metadata metadata, Mod * Reads the entire blob. Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or * {@link AppendBlobClient}. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.download} + * + *

For more information, see the + * Azure Docs

+ * * @return A reactive response containing the blob data. */ public Mono>> download() { - return this.download(null, null, false, null); + return this.download(null, null, null, false); } /** * Reads a range of bytes from a blob. Uploading data must be done from the {@link BlockBlobClient}, {@link * PageBlobClient}, or {@link AppendBlobClient}. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.download#BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean} + * + *

For more information, see the + * Azure Docs

+ * * @param range {@link BlobRange} + * @param options {@link ReliableDownloadOptions} * @param accessConditions {@link BlobAccessConditions} * @param rangeGetContentMD5 Whether the contentMD5 for the specified blob range should be returned. - * @param options {@link ReliableDownloadOptions} * @return A reactive response containing the blob data. */ - public Mono>> download(BlobRange range, BlobAccessConditions accessConditions, boolean rangeGetContentMD5, ReliableDownloadOptions options) { + public Mono>> download(BlobRange range, ReliableDownloadOptions options, BlobAccessConditions accessConditions, boolean rangeGetContentMD5) { return this.download(range, accessConditions, rangeGetContentMD5) .map(response -> new SimpleResponse<>( response.rawResponse(), @@ -359,11 +416,18 @@ Mono download(BlobRange range, BlobAccessConditions acces * This method makes an extra HTTP call to get the length of the blob in the beginning. To avoid this extra call, * use the other overload providing the {@link BlobRange} parameter. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.downloadToFile#String} + * + *

For more information, see the + * Azure Docs

+ * * @param filePath A non-null {@link OutputStream} instance where the downloaded data will be written. * @return An empty response */ public Mono downloadToFile(String filePath) { - return this.downloadToFile(filePath, null, BLOB_DEFAULT_DOWNLOAD_BLOCK_SIZE, null, false, null); + return this.downloadToFile(filePath, null, BLOB_DEFAULT_DOWNLOAD_BLOCK_SIZE, null, null, false); } /** @@ -374,18 +438,25 @@ public Mono downloadToFile(String filePath) { * This method makes an extra HTTP call to get the length of the blob in the beginning. To avoid this extra call, * provide the {@link BlobRange} parameter. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean} + * + *

For more information, see the + * Azure Docs

+ * * @param filePath A non-null {@link OutputStream} instance where the downloaded data will be written. * @param range {@link BlobRange} * @param blockSize the size of a chunk to download at a time, in bytes + * @param options {@link ReliableDownloadOptions} * @param accessConditions {@link BlobAccessConditions} * @param rangeGetContentMD5 Whether the contentMD5 for the specified blob range should be returned. - * @param options {@link ReliableDownloadOptions} * @return An empty response * @throws IllegalArgumentException If {@code blockSize} is less than 0 or greater than 100MB. * @throws UncheckedIOException If an I/O error occurs. */ - public Mono downloadToFile(String filePath, BlobRange range, Integer blockSize, BlobAccessConditions accessConditions, - boolean rangeGetContentMD5, ReliableDownloadOptions options) { + public Mono downloadToFile(String filePath, BlobRange range, Integer blockSize, ReliableDownloadOptions options, + BlobAccessConditions accessConditions, boolean rangeGetContentMD5) { if (blockSize < 0 || blockSize > BLOB_MAX_DOWNLOAD_BLOCK_SIZE) { throw new IllegalArgumentException("Block size should not exceed 100MB"); } @@ -440,6 +511,13 @@ private List sliceBlobRange(BlobRange blobRange, Integer blockSize) { /** * Deletes the specified blob or snapshot. Note that deleting a blob also deletes all its snapshots. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.delete} + * + *

For more information, see the + * Azure Docs

+ * * @return A reactive response signalling completion. */ public Mono delete() { @@ -449,6 +527,13 @@ public Mono delete() { /** * Deletes the specified blob or snapshot. Note that deleting a blob also deletes all its snapshots. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.delete#DeleteSnapshotsOptionType-BlobAccessConditions} + * + *

For more information, see the + * Azure Docs

+ * * @param deleteBlobSnapshotOptions Specifies the behavior for deleting the snapshots on this blob. {@code Include} * will delete the base blob and all snapshots. {@code Only} will delete only the snapshots. If a snapshot is being * deleted, you must pass null. @@ -468,6 +553,13 @@ public Mono delete(DeleteSnapshotsOptionType deleteBlobSnapshotOpt /** * Returns the blob's metadata and properties. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.getProperties} + * + *

For more information, see the + * Azure Docs

+ * * @return A reactive response containing the blob properties and metadata. */ public Mono> getProperties() { @@ -477,6 +569,13 @@ public Mono> getProperties() { /** * Returns the blob's metadata and properties. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.getProperties#BlobAccessConditions} + * + *

For more information, see the + * Azure Docs

+ * * @param accessConditions {@link BlobAccessConditions} * @return A reactive response containing the blob properties and metadata. */ @@ -492,9 +591,14 @@ public Mono> getProperties(BlobAccessConditions accessC /** * Changes a blob's HTTP header properties. if only one HTTP header is updated, the others will all be erased. In - * order to preserve existing values, they must be passed alongside the header being changed. For more information, - * see the - * Azure Docs. + * order to preserve existing values, they must be passed alongside the header being changed. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.setHTTPHeaders#BlobHTTPHeaders} + * + *

For more information, see the + * Azure Docs

* * @param headers {@link BlobHTTPHeaders} * @return A reactive response signalling completion. @@ -505,9 +609,14 @@ public Mono setHTTPHeaders(BlobHTTPHeaders headers) { /** * Changes a blob's HTTP header properties. if only one HTTP header is updated, the others will all be erased. In - * order to preserve existing values, they must be passed alongside the header being changed. For more information, - * see the - * Azure Docs. + * order to preserve existing values, they must be passed alongside the header being changed. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions} + * + *

For more information, see the + * Azure Docs

* * @param headers {@link BlobHTTPHeaders} * @param accessConditions {@link BlobAccessConditions} @@ -524,8 +633,14 @@ public Mono setHTTPHeaders(BlobHTTPHeaders headers, BlobAccessCond /** * Changes a blob's metadata. The specified metadata in this method will replace existing metadata. If old values - * must be preserved, they must be downloaded and included in the call to this method. For more information, see the - * Azure Docs. + * must be preserved, they must be downloaded and included in the call to this method. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.setMetadata#Metadata} + * + *

For more information, see the + * Azure Docs

* * @param metadata {@link Metadata} * @return A reactive response signalling completion. @@ -536,8 +651,14 @@ public Mono setMetadata(Metadata metadata) { /** * Changes a blob's metadata. The specified metadata in this method will replace existing metadata. If old values - * must be preserved, they must be downloaded and included in the call to this method. For more information, see the - * Azure Docs. + * must be preserved, they must be downloaded and included in the call to this method. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.setMetadata#Metadata-BlobAccessConditions} + * + *

For more information, see the + * Azure Docs

* * @param metadata {@link Metadata} * @param accessConditions {@link BlobAccessConditions} @@ -557,6 +678,13 @@ public Mono setMetadata(Metadata metadata, BlobAccessConditions ac /** * Creates a read-only snapshot of a blob. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.createSnapshot} + * + *

For more information, see the + * Azure Docs

+ * * @return A reactive response containing the ID of the new snapshot. */ public Mono> createSnapshot() { @@ -566,6 +694,13 @@ public Mono> createSnapshot() { /** * Creates a read-only snapshot of a blob. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.createSnapshot#Metadata-BlobAccessConditions} + * + *

For more information, see the + * Azure Docs

+ * * @param metadata {@link Metadata} * @param accessConditions {@link BlobAccessConditions} * @return A reactive response containing the ID of the new snapshot. @@ -587,6 +722,13 @@ public Mono> createSnapshot(Metadata metadata, BlobAccessCondit * the blob. A block blob's tier determines the Hot/Cool/Archive storage type. This does not update the blob's * etag. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.setTier#AccessTier} + * + *

For more information, see the + * Azure Docs

+ * * @param tier The new tier for the blob. * @return A reactive response signalling completion. */ @@ -600,6 +742,13 @@ public Mono setTier(AccessTier tier) { * the blob. A block blob's tier determines the Hot/Cool/Archive storage type. This does not update the blob's * etag. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.setTier#AccessTier-LeaseAccessConditions} + * + *

For more information, see the + * Azure Docs

+ * * @param tier The new tier for the blob. * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does * not match the active lease on the blob. @@ -616,6 +765,13 @@ public Mono setTier(AccessTier tier, LeaseAccessConditions leaseAc /** * Undelete restores the content and metadata of a soft-deleted blob and/or any associated soft-deleted snapshots. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.undelete} + * + *

For more information, see the + * Azure Docs

+ * * @return A reactive response signalling completion. */ public Mono undelete() { @@ -628,6 +784,13 @@ public Mono undelete() { * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 * seconds, or infinite (-1). * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int} + * + *

For more information, see the + * Azure Docs

+ * * @param proposedId A {@code String} in any valid GUID format. May be null. * @param duration The duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A * non-infinite lease can be between 15 and 60 seconds. @@ -641,7 +804,14 @@ public Mono> acquireLease(String proposedId, int duration) { * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 * seconds, or infinite (-1). * - * @param proposedID A {@code String} in any valid GUID format. May be null. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int-ModifiedAccessConditions} + * + *

For more information, see the + * Azure Docs

+ * + * @param proposedId A {@code String} in any valid GUID format. May be null. * @param duration The duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A * non-infinite lease can be between 15 and 60 seconds. * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and @@ -650,7 +820,7 @@ public Mono> acquireLease(String proposedId, int duration) { * @return A reactive response containing the lease ID. * @throws IllegalArgumentException If {@code duration} is outside the bounds of 15 to 60 or isn't -1. */ - public Mono> acquireLease(String proposedID, int duration, ModifiedAccessConditions modifiedAccessConditions) { + public Mono> acquireLease(String proposedId, int duration, ModifiedAccessConditions modifiedAccessConditions) { if (!(duration == -1 || (duration >= 15 && duration <= 60))) { // Throwing is preferred to Mono.error because this will error out immediately instead of waiting until // subscription. @@ -658,7 +828,7 @@ public Mono> acquireLease(String proposedID, int duration, Modi } return postProcessResponse(this.azureBlobStorage.blobs().acquireLeaseWithRestResponseAsync( - null, null, null, duration, proposedID, null, + null, null, null, duration, proposedId, null, modifiedAccessConditions, Context.NONE)) .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseId())); } @@ -666,50 +836,78 @@ public Mono> acquireLease(String proposedID, int duration, Modi /** * Renews the blob's previously-acquired lease. * - * @param leaseID The leaseId of the active lease on the blob. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.renewLease#String} + * + *

For more information, see the + * Azure Docs

+ * + * @param leaseId The leaseId of the active lease on the blob. * @return A reactive response containing the renewed lease ID. */ - public Mono> renewLease(String leaseID) { - return this.renewLease(leaseID, null); + public Mono> renewLease(String leaseId) { + return this.renewLease(leaseId, null); } /** * Renews the blob's previously-acquired lease. * - * @param leaseID The leaseId of the active lease on the blob. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.renewLease#String-ModifiedAccessConditions} + * + *

For more information, see the + * Azure Docs

+ * + * @param leaseId The leaseId of the active lease on the blob. * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @return A reactive response containing the renewed lease ID. */ - public Mono> renewLease(String leaseID, ModifiedAccessConditions modifiedAccessConditions) { + public Mono> renewLease(String leaseId, ModifiedAccessConditions modifiedAccessConditions) { return postProcessResponse(this.azureBlobStorage.blobs().renewLeaseWithRestResponseAsync(null, - null, leaseID, null, null, modifiedAccessConditions, Context.NONE)) + null, leaseId, null, null, modifiedAccessConditions, Context.NONE)) .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseId())); } /** * Releases the blob's previously-acquired lease. * - * @param leaseID The leaseId of the active lease on the blob. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.releaseLease#String} + * + *

For more information, see the + * Azure Docs

+ * + * @param leaseId The leaseId of the active lease on the blob. * @return A reactive response signalling completion. */ - public Mono releaseLease(String leaseID) { - return this.releaseLease(leaseID, null); + public Mono releaseLease(String leaseId) { + return this.releaseLease(leaseId, null); } /** * Releases the blob's previously-acquired lease. * - * @param leaseID The leaseId of the active lease on the blob. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.releaseLease#String-ModifiedAccessConditions} + * + *

For more information, see the + * Azure Docs

+ * + * @param leaseId The leaseId of the active lease on the blob. * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @return A reactive response signalling completion. */ - public Mono releaseLease(String leaseID, ModifiedAccessConditions modifiedAccessConditions) { + public Mono releaseLease(String leaseId, ModifiedAccessConditions modifiedAccessConditions) { return postProcessResponse(this.azureBlobStorage.blobs().releaseLeaseWithRestResponseAsync(null, - null, leaseID, null, null, modifiedAccessConditions, Context.NONE)) + null, leaseId, null, null, modifiedAccessConditions, Context.NONE)) .map(VoidResponse::new); } @@ -717,6 +915,13 @@ public Mono releaseLease(String leaseID, ModifiedAccessConditions * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant * to break a fixed-duration lease when it expires or an infinite lease immediately. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.breakLease} + * + *

For more information, see the + * Azure Docs

+ * * @return A reactive response containing the remaining time in the broken lease in seconds. */ public Mono> breakLease() { @@ -727,6 +932,13 @@ public Mono> breakLease() { * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant * to break a fixed-duration lease when it expires or an infinite lease immediately. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.breakLease#Integer-ModifiedAccessConditions} + * + *

For more information, see the + * Azure Docs

+ * * @param breakPeriodInSeconds An optional {@code Integer} representing the proposed duration of seconds that the * lease should continue before it is broken, between 0 and 60 seconds. This break period is only used if it is * shorter than the time remaining on the lease. If longer, the time remaining on the lease is used. A new lease @@ -746,38 +958,56 @@ public Mono> breakLease(Integer breakPeriodInSeconds, Modified /** * ChangeLease changes the blob's lease ID. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.changeLease#String-String} + * + *

For more information, see the + * Azure Docs

+ * * @param leaseId The leaseId of the active lease on the blob. - * @param proposedID A {@code String} in any valid GUID format. + * @param proposedId A {@code String} in any valid GUID format. * @return A reactive response containing the new lease ID. */ - public Mono> changeLease(String leaseId, String proposedID) { - return this.changeLease(leaseId, proposedID, null); + public Mono> changeLease(String leaseId, String proposedId) { + return this.changeLease(leaseId, proposedId, null); } /** - * ChangeLease changes the blob's lease ID. For more information, see the Azure - * Docs. + * ChangeLease changes the blob's lease ID. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.changeLease#String-String-ModifiedAccessConditions} + * + *

For more information, see the + * Azure Docs

* * @param leaseId The leaseId of the active lease on the blob. - * @param proposedID A {@code String} in any valid GUID format. + * @param proposedId A {@code String} in any valid GUID format. * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @return A reactive response containing the new lease ID. */ - public Mono> changeLease(String leaseId, String proposedID, ModifiedAccessConditions modifiedAccessConditions) { + public Mono> changeLease(String leaseId, String proposedId, ModifiedAccessConditions modifiedAccessConditions) { return postProcessResponse(this.azureBlobStorage.blobs().changeLeaseWithRestResponseAsync(null, - null, leaseId, proposedID, null, null, modifiedAccessConditions, Context.NONE)) + null, leaseId, proposedId, null, null, modifiedAccessConditions, Context.NONE)) .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseId())); } /** - * Returns the sku name and account kind for the account. For more information, please see the Azure Docs. + * Returns the sku name and account kind for the account. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.getAccountInfo} + * + *

For more information, see the + * Azure Docs

* * @return a reactor response containing the sku name and account kind. */ - // TODO (unknown): determine this return type public Mono> getAccountInfo() { return postProcessResponse( this.azureBlobStorage.blobs().getAccountInfoWithRestResponseAsync(null, null, Context.NONE)) diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/BlobClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobClient.java index e2c6eab47a76..c88bac43c0da 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/BlobClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobClient.java @@ -39,13 +39,12 @@ * *

* This client contains operations on a blob. Operations on a container are available on {@link ContainerClient}, and - * operations on the service are available on {@link StorageClient}. + * operations on the service are available on {@link BlobServiceClient}. * *

* Please refer to the Azure * Docs for more information. */ -@SuppressWarnings({"unused", "WeakerAccess"}) public class BlobClient { private final BlobAsyncClient blobAsyncClient; @@ -136,6 +135,10 @@ public final BlobInputStream openInputStream(BlobRange range, BlobAccessConditio /** * Gets if the container this client represents exists in the cloud. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.exists} + * * @return true if the container exists, false if it doesn't */ public Response exists() { @@ -145,6 +148,10 @@ public Response exists() { /** * Gets if the container this client represents exists in the cloud. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.exists#Duration} + * * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return true if the container exists, false if it doesn't */ @@ -155,8 +162,14 @@ public Response exists(Duration timeout) { } /** - * Copies the data at the source URL to a blob. For more information, see the - * Azure Docs + * Copies the data at the source URL to a blob. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.startCopyFromURL#URL} + * + *

For more information, see the + * Azure Docs

* * @param sourceURL The source URL to copy from. URLs outside of Azure may only be copied to block blobs. * @return The copy ID for the long running operation. @@ -166,8 +179,14 @@ public Response startCopyFromURL(URL sourceURL) { } /** - * Copies the data at the source URL to a blob. For more information, see the - * Azure Docs + * Copies the data at the source URL to a blob. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.startCopyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration} + * + *

For more information, see the + * Azure Docs

* * @param sourceURL The source URL to copy from. URLs outside of Azure may only be copied to block blobs. * @param metadata {@link Metadata} @@ -179,9 +198,8 @@ public Response startCopyFromURL(URL sourceURL) { * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return The copy ID for the long running operation. */ - public Response startCopyFromURL(URL sourceURL, Metadata metadata, - ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions, - Duration timeout) { + public Response startCopyFromURL(URL sourceURL, Metadata metadata, ModifiedAccessConditions sourceModifiedAccessConditions, + BlobAccessConditions destAccessConditions, Duration timeout) { Mono> response = blobAsyncClient .startCopyFromURL(sourceURL, metadata, sourceModifiedAccessConditions, destAccessConditions); @@ -191,6 +209,13 @@ public Response startCopyFromURL(URL sourceURL, Metadata metadata, /** * Stops a pending copy that was previously started and leaves a destination blob with 0 length and metadata. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.abortCopyFromURL#String} + * + *

For more information, see the + * Azure Docs

+ * * @param copyId The id of the copy operation to abort. Returned as the {@code copyId} field on the {@link * BlobStartCopyFromURLHeaders} object. * @return A response containing status code and HTTP headers. @@ -202,6 +227,13 @@ public VoidResponse abortCopyFromURL(String copyId) { /** * Stops a pending copy that was previously started and leaves a destination blob with 0 length and metadata. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.abortCopyFromURL#String-LeaseAccessConditions-Duration} + * + *

For more information, see the + * Azure Docs

+ * * @param copyId The id of the copy operation to abort. Returned as the {@code copyId} field on the {@link * BlobStartCopyFromURLHeaders} object. * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does @@ -219,6 +251,13 @@ public VoidResponse abortCopyFromURL(String copyId, LeaseAccessConditions leaseA /** * Copies the data at the source URL to a blob and waits for the copy to complete before returning a response. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.copyFromURL#URL} + * + *

For more information, see the + * Azure Docs

+ * * @param copySource The source URL to copy from. * @return The copy ID for the long running operation. */ @@ -229,6 +268,13 @@ public Response copyFromURL(URL copySource) { /** * Copies the data at the source URL to a blob and waits for the copy to complete before returning a response. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.copyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration} + * + *

For more information, see the + * Azure Docs

+ * * @param copySource The source URL to copy from. URLs outside of Azure may only be copied to block blobs. * @param metadata {@link Metadata} * @param sourceModifiedAccessConditions {@link ModifiedAccessConditions} against the source. Standard HTTP Access @@ -239,9 +285,8 @@ public Response copyFromURL(URL copySource) { * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return The copy ID for the long running operation. */ - public Response copyFromURL(URL copySource, Metadata metadata, - ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions, - Duration timeout) { + public Response copyFromURL(URL copySource, Metadata metadata, ModifiedAccessConditions sourceModifiedAccessConditions, + BlobAccessConditions destAccessConditions, Duration timeout) { Mono> response = blobAsyncClient .copyFromURL(copySource, metadata, sourceModifiedAccessConditions, destAccessConditions); @@ -252,6 +297,13 @@ public Response copyFromURL(URL copySource, Metadata metadata, * Downloads the entire blob into an output stream. Uploading data must be done from the {@link BlockBlobClient}, * {@link PageBlobClient}, or {@link AppendBlobClient}. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.download#OutputStream} + * + *

For more information, see the + * Azure Docs

+ * * @param stream A non-null {@link OutputStream} instance where the downloaded data will be written. * @return A response containing status code and HTTP headers. * @throws UncheckedIOException If an I/O error occurs. @@ -264,19 +316,26 @@ public VoidResponse download(OutputStream stream) { * Downloads a range of bytes from a blob into an output stream. Uploading data must be done from the {@link * BlockBlobClient}, {@link PageBlobClient}, or {@link AppendBlobClient}. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.download#OutputStream-BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration} + * + *

For more information, see the + * Azure Docs

+ * * @param stream A non-null {@link OutputStream} instance where the downloaded data will be written. - * @param options {@link ReliableDownloadOptions} * @param range {@link BlobRange} + * @param options {@link ReliableDownloadOptions} * @param accessConditions {@link BlobAccessConditions} * @param rangeGetContentMD5 Whether the contentMD5 for the specified blob range should be returned. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return A response containing status code and HTTP headers. * @throws UncheckedIOException If an I/O error occurs. */ - public VoidResponse download(OutputStream stream, ReliableDownloadOptions options, BlobRange range, + public VoidResponse download(OutputStream stream, BlobRange range, ReliableDownloadOptions options, BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Duration timeout) { Mono download = blobAsyncClient - .download(range, accessConditions, rangeGetContentMD5, options) + .download(range, options, accessConditions, rangeGetContentMD5) .flatMapMany(res -> res.value() .doOnNext(bf -> { try { @@ -296,10 +355,17 @@ public VoidResponse download(OutputStream stream, ReliableDownloadOptions option * Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link * AppendBlobClient}. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.downloadToFile#String} + * + *

For more information, see the + * Azure Docs

+ * * @param filePath A non-null {@link OutputStream} instance where the downloaded data will be written. - * @throws IOException If an I/O error occurs + * @throws UncheckedIOException If an I/O error occurs */ - public void downloadToFile(String filePath) throws IOException { + public void downloadToFile(String filePath) { blobAsyncClient.downloadToFile(filePath); } @@ -308,29 +374,39 @@ public void downloadToFile(String filePath) throws IOException { * Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link * AppendBlobClient}. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration} + * + *

For more information, see the + * Azure Docs

+ * * @param filePath A non-null {@link OutputStream} instance where the downloaded data will be written. - * @param options {@link ReliableDownloadOptions} * @param range {@link BlobRange} * @param blockSize the size of a chunk to download at a time, in bytes + * @param options {@link ReliableDownloadOptions} * @param accessConditions {@link BlobAccessConditions} * @param rangeGetContentMD5 Whether the contentMD5 for the specified blob range should be returned. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @throws IOException If an I/O error occurs + * @throws UncheckedIOException If an I/O error occurs */ - public void downloadToFile(String filePath, ReliableDownloadOptions options, BlobRange range, Integer blockSize, - BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Duration timeout) throws IOException { - Mono download = blobAsyncClient.downloadToFile(filePath, range, blockSize, accessConditions, rangeGetContentMD5, options); + public void downloadToFile(String filePath, BlobRange range, Integer blockSize, ReliableDownloadOptions options, + BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Duration timeout) { + Mono download = blobAsyncClient.downloadToFile(filePath, range, blockSize, options, accessConditions, rangeGetContentMD5); - try { - Utility.blockWithOptionalTimeout(download, timeout); - } catch (UncheckedIOException e) { - throw e.getCause(); - } + Utility.blockWithOptionalTimeout(download, timeout); } /** * Deletes the specified blob or snapshot. Note that deleting a blob also deletes all its snapshots. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.delete} + * + *

For more information, see the + * Azure Docs

+ * * @return A response containing status code and HTTP headers. */ public VoidResponse delete() { @@ -340,6 +416,13 @@ public VoidResponse delete() { /** * Deletes the specified blob or snapshot. Note that deleting a blob also deletes all its snapshots. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.delete#DeleteSnapshotsOptionType-BlobAccessConditions-Duration} + * + *

For more information, see the + * Azure Docs

+ * * @param deleteBlobSnapshotOptions Specifies the behavior for deleting the snapshots on this blob. {@code Include} * will delete the base blob and all snapshots. {@code Only} will delete only the snapshots. If a snapshot is being * deleted, you must pass null. @@ -358,6 +441,13 @@ public VoidResponse delete(DeleteSnapshotsOptionType deleteBlobSnapshotOptions, /** * Returns the blob's metadata and properties. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.getProperties} + * + *

For more information, see the + * Azure Docs

+ * * @return The blob properties and metadata. */ public Response getProperties() { @@ -367,6 +457,13 @@ public Response getProperties() { /** * Returns the blob's metadata and properties. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.getProperties#BlobAccessConditions-Duration} + * + *

For more information, see the + * Azure Docs

+ * * @param accessConditions {@link BlobAccessConditions} * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return The blob properties and metadata. @@ -380,9 +477,14 @@ public Response getProperties(BlobAccessConditions accessConditi /** * Changes a blob's HTTP header properties. if only one HTTP header is updated, the others will all be erased. In - * order to preserve existing values, they must be passed alongside the header being changed. For more information, - * see the - * Azure Docs. + * order to preserve existing values, they must be passed alongside the header being changed. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders} + * + *

For more information, see the + * Azure Docs

* * @param headers {@link BlobHTTPHeaders} * @return A response containing status code and HTTP headers. @@ -393,9 +495,14 @@ public VoidResponse setHTTPHeaders(BlobHTTPHeaders headers) { /** * Changes a blob's HTTP header properties. if only one HTTP header is updated, the others will all be erased. In - * order to preserve existing values, they must be passed alongside the header being changed. For more information, - * see the - * Azure Docs. + * order to preserve existing values, they must be passed alongside the header being changed. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions-Duration} + * + *

For more information, see the + * Azure Docs

* * @param headers {@link BlobHTTPHeaders} * @param accessConditions {@link BlobAccessConditions} @@ -412,8 +519,14 @@ public VoidResponse setHTTPHeaders(BlobHTTPHeaders headers, BlobAccessConditions /** * Changes a blob's metadata. The specified metadata in this method will replace existing metadata. If old values - * must be preserved, they must be downloaded and included in the call to this method. For more information, see the - * Azure Docs. + * must be preserved, they must be downloaded and included in the call to this method. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.setMetadata#Metadata} + * + *

For more information, see the + * Azure Docs

* * @param metadata {@link Metadata} * @return A response containing status code and HTTP headers. @@ -424,8 +537,14 @@ public VoidResponse setMetadata(Metadata metadata) { /** * Changes a blob's metadata. The specified metadata in this method will replace existing metadata. If old values - * must be preserved, they must be downloaded and included in the call to this method. For more information, see the - * Azure Docs. + * must be preserved, they must be downloaded and included in the call to this method. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.setMetadata#Metadata-BlobAccessConditions-Duration} + * + *

For more information, see the + * Azure Docs

* * @param metadata {@link Metadata} * @param accessConditions {@link BlobAccessConditions} @@ -442,6 +561,13 @@ public VoidResponse setMetadata(Metadata metadata, BlobAccessConditions accessCo /** * Creates a read-only snapshot of a blob. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.createSnapshot} + * + *

For more information, see the + * Azure Docs

+ * * @return The ID of the new snapshot. */ public Response createSnapshot() { @@ -451,6 +577,13 @@ public Response createSnapshot() { /** * Creates a read-only snapshot of a blob. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.createSnapshot#Metadata-BlobAccessConditions-Duration} + * + *

For more information, see the + * Azure Docs

+ * * @param metadata {@link Metadata} * @param accessConditions {@link BlobAccessConditions} * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. @@ -469,6 +602,13 @@ public Response createSnapshot(Metadata metadata, BlobAccessConditions a * the blob. A block blob's tier determines the Hot/Cool/Archive storage type. This does not update the blob's * etag. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.setTier#AccessTier} + * + *

For more information, see the + * Azure Docs

+ * * @param tier The new tier for the blob. * @return A response containing status code and HTTP headers. */ @@ -482,6 +622,13 @@ public VoidResponse setTier(AccessTier tier) { * the blob. A block blob's tier determines the Hot/Cool/Archive storage type. This does not update the blob's * etag. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.setTier#AccessTier-LeaseAccessConditions-Duration} + * + *

For more information, see the + * Azure Docs

+ * * @param tier The new tier for the blob. * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does * not match the active lease on the blob. @@ -498,6 +645,13 @@ public VoidResponse setTier(AccessTier tier, LeaseAccessConditions leaseAccessCo /** * Undelete restores the content and metadata of a soft-deleted blob and/or any associated soft-deleted snapshots. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.undelete} + * + *

For more information, see the + * Azure Docs

+ * * @return A response containing status code and HTTP headers. */ public VoidResponse undelete() { @@ -507,6 +661,13 @@ public VoidResponse undelete() { /** * Undelete restores the content and metadata of a soft-deleted blob and/or any associated soft-deleted snapshots. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.undelete#Duration} + * + *

For more information, see the + * Azure Docs

+ * * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return A response containing status code and HTTP headers. */ @@ -521,6 +682,13 @@ public VoidResponse undelete(Duration timeout) { * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 * seconds, or infinite (-1). * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.acquireLease#String-int} + * + *

For more information, see the + * Azure Docs

+ * * @param proposedId A {@code String} in any valid GUID format. May be null. * @param duration The duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A * non-infinite lease can be between 15 and 60 seconds. @@ -534,7 +702,14 @@ public Response acquireLease(String proposedId, int duration) { * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 * seconds, or infinite (-1). * - * @param proposedID A {@code String} in any valid GUID format. May be null. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.acquireLease#String-int-ModifiedAccessConditions-Duration} + * + *

For more information, see the + * Azure Docs

+ * + * @param proposedId A {@code String} in any valid GUID format. May be null. * @param duration The duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A * non-infinite lease can be between 15 and 60 seconds. * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and @@ -543,10 +718,10 @@ public Response acquireLease(String proposedId, int duration) { * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return The lease ID. */ - public Response acquireLease(String proposedID, int duration, + public Response acquireLease(String proposedId, int duration, ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { Mono> response = blobAsyncClient - .acquireLease(proposedID, duration, modifiedAccessConditions); + .acquireLease(proposedId, duration, modifiedAccessConditions); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -554,27 +729,40 @@ public Response acquireLease(String proposedID, int duration, /** * Renews the blob's previously-acquired lease. * - * @param leaseID The leaseId of the active lease on the blob. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.renewLease#String} + * + *

For more information, see the + * Azure Docs

+ * + * @param leaseId The leaseId of the active lease on the blob. * @return The renewed lease ID. */ - public Response renewLease(String leaseID) { - return this.renewLease(leaseID, null, null); + public Response renewLease(String leaseId) { + return this.renewLease(leaseId, null, null); } /** * Renews the blob's previously-acquired lease. * - * @param leaseID The leaseId of the active lease on the blob. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.renewLease#String-ModifiedAccessConditions-Duration} + * + *

For more information, see the + * Azure Docs

+ * + * @param leaseId The leaseId of the active lease on the blob. * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return The renewed lease ID. */ - public Response renewLease(String leaseID, ModifiedAccessConditions modifiedAccessConditions, - Duration timeout) { + public Response renewLease(String leaseId, ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { Mono> response = blobAsyncClient - .renewLease(leaseID, modifiedAccessConditions); + .renewLease(leaseId, modifiedAccessConditions); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -582,27 +770,39 @@ public Response renewLease(String leaseID, ModifiedAccessConditions modi /** * Releases the blob's previously-acquired lease. * - * @param leaseID The leaseId of the active lease on the blob. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.releaseLease#String} + * + *

For more information, see the + * Azure Docs

+ * + * @param leaseId The leaseId of the active lease on the blob. * @return A response containing status code and HTTP headers. */ - public VoidResponse releaseLease(String leaseID) { - return this.releaseLease(leaseID, null, null); + public VoidResponse releaseLease(String leaseId) { + return this.releaseLease(leaseId, null, null); } /** * Releases the blob's previously-acquired lease. * - * @param leaseID The leaseId of the active lease on the blob. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.releaseLease#String-ModifiedAccessConditions-Duration} + * + *

For more information, see the + * Azure Docs

+ * + * @param leaseId The leaseId of the active lease on the blob. * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return A response containing status code and HTTP headers. */ - public VoidResponse releaseLease(String leaseID, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { - Mono response = blobAsyncClient - .releaseLease(leaseID, modifiedAccessConditions); + public VoidResponse releaseLease(String leaseId, ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { + Mono response = blobAsyncClient.releaseLease(leaseId, modifiedAccessConditions); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -611,6 +811,13 @@ public VoidResponse releaseLease(String leaseID, * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant * to break a fixed-duration lease when it expires or an infinite lease immediately. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.breakLease} + * + *

For more information, see the + * Azure Docs

+ * * @return The remaining time in the broken lease in seconds. */ public Response breakLease() { @@ -621,6 +828,13 @@ public Response breakLease() { * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant * to break a fixed-duration lease when it expires or an infinite lease immediately. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.breakLease#Integer-ModifiedAccessConditions-Duration} + * + *

For more information, see the + * Azure Docs

+ * * @param breakPeriodInSeconds An optional {@code Integer} representing the proposed duration of seconds that the * lease should continue before it is broken, between 0 and 60 seconds. This break period is only used if it is * shorter than the time remaining on the lease. If longer, the time remaining on the lease is used. A new lease @@ -632,8 +846,7 @@ public Response breakLease() { * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return The remaining time in the broken lease in seconds. */ - public Response breakLease(Integer breakPeriodInSeconds, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { + public Response breakLease(Integer breakPeriodInSeconds, ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { Mono> response = blobAsyncClient .breakLease(breakPeriodInSeconds, modifiedAccessConditions); @@ -643,37 +856,54 @@ public Response breakLease(Integer breakPeriodInSeconds, /** * ChangeLease changes the blob's lease ID. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.changeLease#String-String} + * + *

For more information, see the + * Azure Docs

+ * * @param leaseId The leaseId of the active lease on the blob. - * @param proposedID A {@code String} in any valid GUID format. + * @param proposedId A {@code String} in any valid GUID format. * @return The new lease ID. */ - public Response changeLease(String leaseId, String proposedID) { - return this.changeLease(leaseId, proposedID, null, null); + public Response changeLease(String leaseId, String proposedId) { + return this.changeLease(leaseId, proposedId, null, null); } /** - * ChangeLease changes the blob's lease ID. For more information, see the Azure - * Docs. + * ChangeLease changes the blob's lease ID. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.changeLease#String-String-ModifiedAccessConditions-Duration} + * + *

For more information, see the + * Azure Docs

* * @param leaseId The leaseId of the active lease on the blob. - * @param proposedID A {@code String} in any valid GUID format. + * @param proposedId A {@code String} in any valid GUID format. * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return The new lease ID. */ - public Response changeLease(String leaseId, String proposedID, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { - Mono> response = blobAsyncClient - .changeLease(leaseId, proposedID, modifiedAccessConditions); + public Response changeLease(String leaseId, String proposedId, ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { + Mono> response = blobAsyncClient.changeLease(leaseId, proposedId, modifiedAccessConditions); return Utility.blockWithOptionalTimeout(response, timeout); } /** - * Returns the sku name and account kind for the account. For more information, please see the Azure Docs. + * Returns the sku name and account kind for the account. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.getAccountInfo} + * + *

For more information, see the + * Azure Docs

* * @return The sku name and account kind. */ @@ -682,8 +912,14 @@ public Response getAccountInfo() { } /** - * Returns the sku name and account kind for the account. For more information, please see the Azure Docs. + * Returns the sku name and account kind for the account. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.getAccountInfo#Duration} + * + *

For more information, see the + * Azure Docs

* * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return The sku name and account kind. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/StorageAsyncClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/StorageAsyncClient.java rename to storage/client/blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java index e84d23ee1dbe..4738c234387b 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/StorageAsyncClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java @@ -32,7 +32,7 @@ import static com.azure.storage.blob.Utility.postProcessResponse; /** - * Client to a storage account. It may only be instantiated through a {@link StorageClientBuilder}. This class does not + * Client to a storage account. It may only be instantiated through a {@link BlobServiceClientBuilder}. This class does not * hold any state about a particular storage account but is instead a convenient way of sending off appropriate requests * to the resource on the service. It may also be used to construct URLs to blobs and containers. * @@ -50,15 +50,15 @@ * operation, until {@code .subscribe()} is called on the reactive response. You can simply convert one of these * responses to a {@link java.util.concurrent.CompletableFuture} object through {@link Mono#toFuture()}. */ -public final class StorageAsyncClient { +public final class BlobServiceAsyncClient { private final AzureBlobStorageImpl azureBlobStorage; /** - * Package-private constructor for use by {@link StorageClientBuilder}. + * Package-private constructor for use by {@link BlobServiceClientBuilder}. * * @param azureBlobStorageBuilder the API client builder for blob storage API */ - StorageAsyncClient(AzureBlobStorageBuilder azureBlobStorageBuilder) { + BlobServiceAsyncClient(AzureBlobStorageBuilder azureBlobStorageBuilder) { this.azureBlobStorage = azureBlobStorageBuilder.build(); } diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/StorageClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java similarity index 89% rename from storage/client/blob/src/main/java/com/azure/storage/blob/StorageClient.java rename to storage/client/blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java index 5749b1b3fe7d..782e766330ab 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/StorageClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java @@ -24,7 +24,7 @@ import java.time.OffsetDateTime; /** - * Client to a storage account. It may only be instantiated through a {@link StorageClientBuilder}. This class does not + * Client to a storage account. It may only be instantiated through a {@link BlobServiceClientBuilder}. This class does not * hold any state about a particular storage account but is instead a convenient way of sending off appropriate requests * to the resource on the service. It may also be used to construct URLs to blobs and containers. * @@ -36,16 +36,16 @@ * Please see here for more * information on containers. */ -public final class StorageClient { - private final StorageAsyncClient storageAsyncClient; +public final class BlobServiceClient { + private final BlobServiceAsyncClient blobServiceAsyncClient; /** - * Package-private constructor for use by {@link StorageClientBuilder}. + * Package-private constructor for use by {@link BlobServiceClientBuilder}. * - * @param storageAsyncClient the async storage account client + * @param blobServiceAsyncClient the async storage account client */ - StorageClient(StorageAsyncClient storageAsyncClient) { - this.storageAsyncClient = storageAsyncClient; + BlobServiceClient(BlobServiceAsyncClient blobServiceAsyncClient) { + this.blobServiceAsyncClient = blobServiceAsyncClient; } /** @@ -56,7 +56,7 @@ public final class StorageClient { * @return A {@link ContainerClient} object pointing to the specified container */ public ContainerClient getContainerClient(String containerName) { - return new ContainerClient(storageAsyncClient.getContainerAsyncClient(containerName)); + return new ContainerClient(blobServiceAsyncClient.getContainerAsyncClient(containerName)); } /** @@ -96,7 +96,7 @@ public Response createContainer(String containerName, Metadata * @return A response containing status code and HTTP headers */ public VoidResponse deleteContainer(String containerName) { - return storageAsyncClient.deleteContainer(containerName).block(); + return blobServiceAsyncClient.deleteContainer(containerName).block(); } /** @@ -105,7 +105,7 @@ public VoidResponse deleteContainer(String containerName) { * @return the URL. */ public URL getAccountUrl() { - return storageAsyncClient.getAccountUrl(); + return blobServiceAsyncClient.getAccountUrl(); } /** @@ -129,7 +129,7 @@ public Iterable listContainers() { * @return The list of containers. */ public Iterable listContainers(ListContainersOptions options, Duration timeout) { - Flux response = storageAsyncClient.listContainers(options); + Flux response = blobServiceAsyncClient.listContainers(options); return timeout == null ? response.toIterable() : response.timeout(timeout).toIterable(); } @@ -153,7 +153,7 @@ public Response getProperties() { */ public Response getProperties(Duration timeout) { - Mono> response = storageAsyncClient.getProperties(); + Mono> response = blobServiceAsyncClient.getProperties(); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -182,7 +182,7 @@ public VoidResponse setProperties(StorageServiceProperties properties) { * @return The storage account properties. */ public VoidResponse setProperties(StorageServiceProperties properties, Duration timeout) { - Mono response = storageAsyncClient.setProperties(properties); + Mono response = blobServiceAsyncClient.setProperties(properties); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -210,7 +210,7 @@ public Response getUserDelegationKey(OffsetDateTime start, Of */ public Response getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry, Duration timeout) { - Mono> response = storageAsyncClient.getUserDelegationKey(start, expiry); + Mono> response = blobServiceAsyncClient.getUserDelegationKey(start, expiry); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -237,7 +237,7 @@ public Response getStatistics() { * @return The storage account statistics. */ public Response getStatistics(Duration timeout) { - Mono> response = storageAsyncClient.getStatistics(); + Mono> response = blobServiceAsyncClient.getStatistics(); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -260,7 +260,7 @@ public Response getAccountInfo() { * @return The storage account info. */ public Response getAccountInfo(Duration timeout) { - Mono> response = storageAsyncClient.getAccountInfo(); + Mono> response = blobServiceAsyncClient.getAccountInfo(); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -276,7 +276,7 @@ public Response getAccountInfo(Duration timeout) { */ public String generateAccountSAS(AccountSASService accountSASService, AccountSASResourceType accountSASResourceType, AccountSASPermission accountSASPermission, OffsetDateTime expiryTime) { - return this.storageAsyncClient.generateAccountSAS(accountSASService, accountSASResourceType, accountSASPermission, expiryTime); + return this.blobServiceAsyncClient.generateAccountSAS(accountSASService, accountSASResourceType, accountSASPermission, expiryTime); } /** @@ -295,6 +295,6 @@ public String generateAccountSAS(AccountSASService accountSASService, AccountSAS public String generateAccountSAS(AccountSASService accountSASService, AccountSASResourceType accountSASResourceType, AccountSASPermission accountSASPermission, OffsetDateTime expiryTime, OffsetDateTime startTime, String version, IPRange ipRange, SASProtocol sasProtocol) { - return this.storageAsyncClient.generateAccountSAS(accountSASService, accountSASResourceType, accountSASPermission, expiryTime, startTime, version, ipRange, sasProtocol); + return this.blobServiceAsyncClient.generateAccountSAS(accountSASService, accountSASResourceType, accountSASPermission, expiryTime, startTime, version, ipRange, sasProtocol); } } diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/StorageClientBuilder.java b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobServiceClientBuilder.java similarity index 79% rename from storage/client/blob/src/main/java/com/azure/storage/blob/StorageClientBuilder.java rename to storage/client/blob/src/main/java/com/azure/storage/blob/BlobServiceClientBuilder.java index a73249dec8f7..114924273c6c 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/StorageClientBuilder.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobServiceClientBuilder.java @@ -35,8 +35,8 @@ import java.util.Objects; /** - * Fluent StorageClientBuilder for instantiating a {@link StorageClient} or {@link StorageAsyncClient} - * using {@link StorageClientBuilder#buildClient()} or {@link StorageClientBuilder#buildAsyncClient()} respectively. + * Fluent BlobServiceClientBuilder for instantiating a {@link BlobServiceClient} or {@link BlobServiceAsyncClient} + * using {@link BlobServiceClientBuilder#buildClient()} or {@link BlobServiceClientBuilder#buildAsyncClient()} respectively. * *

* The following information must be provided on this builder: @@ -48,9 +48,9 @@ * *

* Once all the configurations are set on this builder, call {@code .buildClient()} to create a - * {@link StorageClient} or {@code .buildAsyncClient()} to create a {@link StorageAsyncClient}. + * {@link BlobServiceClient} or {@code .buildAsyncClient()} to create a {@link BlobServiceAsyncClient}. */ -public final class StorageClientBuilder { +public final class BlobServiceClientBuilder { private static final String ACCOUNT_NAME = "accountname"; private static final String ACCOUNT_KEY = "accountkey"; private static final String ENDPOINT_PROTOCOL = "defaultendpointsprotocol"; @@ -68,10 +68,10 @@ public final class StorageClientBuilder { private Configuration configuration; /** - * Creates a builder instance that is able to configure and construct {@link StorageClient StorageClients} - * and {@link StorageAsyncClient StorageAsyncClients}. + * Creates a builder instance that is able to configure and construct {@link BlobServiceClient BlobServiceClients} + * and {@link BlobServiceAsyncClient BlobServiceAsyncClients}. */ - public StorageClientBuilder() { + public BlobServiceClientBuilder() { retryOptions = new RequestRetryOptions(); logLevel = HttpLogDetailLevel.NONE; policies = new ArrayList<>(); @@ -116,32 +116,32 @@ private AzureBlobStorageBuilder buildImpl() { } /** - * Creates a {@link StorageClient} based on options set in the Builder. + * Creates a {@link BlobServiceClient} based on options set in the Builder. * - * @return a {@link StorageClient} created from the configurations in this builder. + * @return a {@link BlobServiceClient} created from the configurations in this builder. * @throws NullPointerException If {@code endpoint} is {@code null}. */ - public StorageClient buildClient() { - return new StorageClient(buildAsyncClient()); + public BlobServiceClient buildClient() { + return new BlobServiceClient(buildAsyncClient()); } /** - * Creates a {@link StorageAsyncClient} based on options set in the Builder. + * Creates a {@link BlobServiceAsyncClient} based on options set in the Builder. * - * @return a {@link StorageAsyncClient} created from the configurations in this builder. + * @return a {@link BlobServiceAsyncClient} created from the configurations in this builder. * @throws NullPointerException If {@code endpoint} is {@code null}. */ - public StorageAsyncClient buildAsyncClient() { - return new StorageAsyncClient(buildImpl()); + public BlobServiceAsyncClient buildAsyncClient() { + return new BlobServiceAsyncClient(buildImpl()); } /** * Sets the blob service endpoint, additionally parses it for information (SAS token, queue name) * @param endpoint URL of the service - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object * @throws IllegalArgumentException If {@code endpoint} is {@code null} or is a malformed URL. */ - public StorageClientBuilder endpoint(String endpoint) { + public BlobServiceClientBuilder endpoint(String endpoint) { try { URL url = new URL(endpoint); this.endpoint = url.getProtocol() + "://" + url.getAuthority(); @@ -168,7 +168,7 @@ String endpoint() { * @return the updated ContainerClientBuilder object * @throws NullPointerException If {@code credential} is {@code null}. */ - public StorageClientBuilder credential(SharedKeyCredential credential) { + public BlobServiceClientBuilder credential(SharedKeyCredential credential) { this.sharedKeyCredential = Objects.requireNonNull(credential); this.tokenCredential = null; this.sasTokenCredential = null; @@ -178,10 +178,10 @@ public StorageClientBuilder credential(SharedKeyCredential credential) { /** * Sets the credential used to authorize requests sent to the service * @param credential authorization credential - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object * @throws NullPointerException If {@code credential} is {@code null}. */ - public StorageClientBuilder credential(TokenCredential credential) { + public BlobServiceClientBuilder credential(TokenCredential credential) { this.tokenCredential = Objects.requireNonNull(credential); this.sharedKeyCredential = null; this.sasTokenCredential = null; @@ -191,10 +191,10 @@ public StorageClientBuilder credential(TokenCredential credential) { /** * Sets the credential used to authorize requests sent to the service * @param credential authorization credential - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object * @throws NullPointerException If {@code credential} is {@code null}. */ - public StorageClientBuilder credential(SASTokenCredential credential) { + public BlobServiceClientBuilder credential(SASTokenCredential credential) { this.sasTokenCredential = Objects.requireNonNull(credential); this.sharedKeyCredential = null; this.tokenCredential = null; @@ -203,9 +203,9 @@ public StorageClientBuilder credential(SASTokenCredential credential) { /** * Clears the credential used to authorize requests sent to the service - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object */ - public StorageClientBuilder anonymousCredential() { + public BlobServiceClientBuilder anonymousCredential() { this.sharedKeyCredential = null; this.tokenCredential = null; this.sasTokenCredential = null; @@ -215,10 +215,10 @@ public StorageClientBuilder anonymousCredential() { /** * Sets the connection string for the service, parses it for authentication information (account name, account key) * @param connectionString connection string from access keys section - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object * @throws IllegalArgumentException If {@code connectionString} doesn't contain AccountName or AccountKey. */ - public StorageClientBuilder connectionString(String connectionString) { + public BlobServiceClientBuilder connectionString(String connectionString) { Objects.requireNonNull(connectionString); Map connectionKVPs = new HashMap<>(); @@ -248,10 +248,10 @@ public StorageClientBuilder connectionString(String connectionString) { /** * Sets the http client used to send service requests * @param httpClient http client to send requests - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object * @throws NullPointerException If {@code httpClient} is {@code null}. */ - public StorageClientBuilder httpClient(HttpClient httpClient) { + public BlobServiceClientBuilder httpClient(HttpClient httpClient) { this.httpClient = Objects.requireNonNull(httpClient); return this; } @@ -259,10 +259,10 @@ public StorageClientBuilder httpClient(HttpClient httpClient) { /** * Adds a pipeline policy to apply on each request sent * @param pipelinePolicy a pipeline policy - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object * @throws NullPointerException If {@code pipelinePolicy} is {@code null}. */ - public StorageClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { + public BlobServiceClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { this.policies.add(Objects.requireNonNull(pipelinePolicy)); return this; } @@ -270,9 +270,9 @@ public StorageClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { /** * Sets the logging level for service requests * @param logLevel logging level - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object */ - public StorageClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { + public BlobServiceClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { this.logLevel = logLevel; return this; } @@ -281,9 +281,9 @@ public StorageClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { * Sets the configuration object used to retrieve environment configuration values used to buildClient the client with * when they are not set in the appendBlobClientBuilder, defaults to Configuration.NONE * @param configuration configuration store - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object */ - public StorageClientBuilder configuration(Configuration configuration) { + public BlobServiceClientBuilder configuration(Configuration configuration) { this.configuration = configuration; return this; } @@ -291,10 +291,10 @@ public StorageClientBuilder configuration(Configuration configuration) { /** * Sets the request retry options for all the requests made through the client. * @param retryOptions the options to configure retry behaviors - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object * @throws NullPointerException If {@code retryOptions} is {@code null}. */ - public StorageClientBuilder retryOptions(RequestRetryOptions retryOptions) { + public BlobServiceClientBuilder retryOptions(RequestRetryOptions retryOptions) { this.retryOptions = Objects.requireNonNull(retryOptions); return this; } diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/BlobURLParts.java b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobURLParts.java index 1200e960f750..5c629e719ca3 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/BlobURLParts.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobURLParts.java @@ -76,14 +76,14 @@ public BlobURLParts host(String host) { } /** - * The container name or {@code null} if a {@link StorageAsyncClient} was parsed. + * The container name or {@code null} if a {@link BlobServiceAsyncClient} was parsed. */ public String containerName() { return containerName; } /** - * The container name or {@code null} if a {@link StorageAsyncClient} was parsed. + * The container name or {@code null} if a {@link BlobServiceAsyncClient} was parsed. */ public BlobURLParts containerName(String containerName) { this.containerName = containerName; @@ -91,14 +91,14 @@ public BlobURLParts containerName(String containerName) { } /** - * The blob name or {@code null} if a {@link StorageAsyncClient} or {@link ContainerAsyncClient} was parsed. + * The blob name or {@code null} if a {@link BlobServiceAsyncClient} or {@link ContainerAsyncClient} was parsed. */ public String blobName() { return blobName; } /** - * The blob name or {@code null} if a {@link StorageAsyncClient} or {@link ContainerAsyncClient} was parsed. + * The blob name or {@code null} if a {@link BlobServiceAsyncClient} or {@link ContainerAsyncClient} was parsed. */ public BlobURLParts blobName(String blobName) { this.blobName = blobName; diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java index cdb0a06fa68e..ffb2eddc60b8 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java @@ -50,7 +50,7 @@ * *

* This client contains operations on a blob. Operations on a container are available on {@link ContainerAsyncClient}, - * and operations on the service are available on {@link StorageAsyncClient}. + * and operations on the service are available on {@link BlobServiceAsyncClient}. * *

* Please refer diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/BlockBlobClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/BlockBlobClient.java index 6af92555c2b0..69bad81c7ff2 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/BlockBlobClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/BlockBlobClient.java @@ -36,7 +36,7 @@ * *

* This client contains operations on a blob. Operations on a container are available on {@link ContainerClient}, - * and operations on the service are available on {@link StorageClient}. + * and operations on the service are available on {@link BlobServiceClient}. * *

* Please refer to the Azure Docs diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java index f9cf29c3e79f..67bd29d4d381 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java @@ -41,13 +41,13 @@ /** * Client to a container. It may only be instantiated through a {@link ContainerClientBuilder} or via the method {@link - * StorageAsyncClient#getContainerAsyncClient(String)}. This class does not hold any state about a particular blob but + * BlobServiceAsyncClient#getContainerAsyncClient(String)}. This class does not hold any state about a particular blob but * is instead a convenient way of sending off appropriate requests to the resource on the service. It may also be used * to construct URLs to blobs. * *

* This client contains operations on a container. Operations on a blob are available on {@link BlobAsyncClient} through - * {@link #getBlobAsyncClient(String)}, and operations on the service are available on {@link StorageAsyncClient}. + * {@link #getBlobAsyncClient(String)}, and operations on the service are available on {@link BlobServiceAsyncClient}. * *

* Please refer to the Azure @@ -206,12 +206,12 @@ public BlobAsyncClient getBlobAsyncClient(String blobName, String snapshot) { } /** - * Initializes a {@link StorageAsyncClient} object pointing to the storage account this container is in. + * Initializes a {@link BlobServiceAsyncClient} object pointing to the storage account this container is in. * - * @return A {@link StorageAsyncClient} object pointing to the specified storage account + * @return A {@link BlobServiceAsyncClient} object pointing to the specified storage account */ - public StorageAsyncClient getStorageAsyncClient() { - return new StorageAsyncClient(new AzureBlobStorageBuilder() + public BlobServiceAsyncClient getBlobServiceAsyncClient() { + return new BlobServiceAsyncClient(new AzureBlobStorageBuilder() .url(Utility.stripLastPathSegment(getContainerUrl()).toString()) .pipeline(azureBlobStorage.getHttpPipeline())); } diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerClient.java index 12d5844a696f..c66b9d8c2373 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerClient.java @@ -26,13 +26,13 @@ /** * Client to a container. It may only be instantiated through a {@link ContainerClientBuilder} or via the method {@link - * StorageClient#getContainerClient(String)}. This class does not hold any state about a particular container but is + * BlobServiceClient#getContainerClient(String)}. This class does not hold any state about a particular container but is * instead a convenient way of sending off appropriate requests to the resource on the service. It may also be used to * construct URLs to blobs. * *

* This client contains operations on a container. Operations on a blob are available on {@link BlobClient} through - * {@link #getBlobClient(String)}, and operations on the service are available on {@link StorageClient}. + * {@link #getBlobClient(String)}, and operations on the service are available on {@link BlobServiceClient}. * *

* Please refer to the Azure @@ -171,12 +171,12 @@ public BlobClient getBlobClient(String blobName, String snapshot) { } /** - * Initializes a {@link StorageClient} object pointing to the storage account this container is in. + * Initializes a {@link BlobServiceClient} object pointing to the storage account this container is in. * - * @return A {@link StorageClient} object pointing to the specified storage account + * @return A {@link BlobServiceClient} object pointing to the specified storage account */ - public StorageClient getStorageClient() { - return new StorageClient(containerAsyncClient.getStorageAsyncClient()); + public BlobServiceClient getBlobServiceClient() { + return new BlobServiceClient(containerAsyncClient.getBlobServiceAsyncClient()); } /** diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/DownloadAsyncResponse.java b/storage/client/blob/src/main/java/com/azure/storage/blob/DownloadAsyncResponse.java index e22a3fa72a16..c27ad3645d20 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/DownloadAsyncResponse.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/DownloadAsyncResponse.java @@ -18,7 +18,7 @@ /** * {@code DownloadAsyncResponse} wraps the protocol-layer response from {@link BlobAsyncClient#download(BlobRange, - * BlobAccessConditions, boolean, ReliableDownloadOptions)} to automatically retry failed reads from the body as + * ReliableDownloadOptions, BlobAccessConditions, boolean)} to automatically retry failed reads from the body as * appropriate. If the download is interrupted, the {@code DownloadAsyncResponse} will make a request to resume the download * from where it left off, allowing the user to consume the data as one continuous stream, for any interruptions are * hidden. The retry behavior is defined by the options passed to the {@link #body(ReliableDownloadOptions)}. The diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java index 925f167b2ad9..3f5467a7a6a7 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java @@ -37,7 +37,7 @@ * *

* This client contains operations on a blob. Operations on a container are available on {@link ContainerAsyncClient}, - * and operations on the service are available on {@link StorageAsyncClient}. + * and operations on the service are available on {@link BlobServiceAsyncClient}. * *

* Please refer diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/PageBlobClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/PageBlobClient.java index 14c0ea4644de..fc84f9c9ea21 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/PageBlobClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/PageBlobClient.java @@ -34,7 +34,7 @@ * *

* This client contains operations on a blob. Operations on a container are available on {@link ContainerClient}, - * and operations on the service are available on {@link StorageClient}. + * and operations on the service are available on {@link BlobServiceClient}. * *

* Please refer to the Azure Docs diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/SignedIdentifierWrapper.java b/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/SignedIdentifierWrapper.java index 8ad4982f3220..69a4eb5ed6c5 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/SignedIdentifierWrapper.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/SignedIdentifierWrapper.java @@ -14,7 +14,7 @@ /** * A wrapper around List<SignedIdentifier> which provides top-level metadata for serialization. */ -@JacksonXmlRootElement(localName = "SignedIdentifier") +@JacksonXmlRootElement(localName = "SignedIdentifiers") public final class SignedIdentifierWrapper { @JacksonXmlProperty(localName = "SignedIdentifier") private final List signedIdentifier; diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerListDetails.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerListDetails.java index f51d897112d5..fbca16f733d7 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerListDetails.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerListDetails.java @@ -3,11 +3,11 @@ package com.azure.storage.blob.models; -import com.azure.storage.blob.StorageClient; +import com.azure.storage.blob.BlobServiceClient; /** * This type allows users to specify additional information the service should return with each container when listing - * containers in an account (via a {@link StorageClient} object). This type is immutable to ensure thread-safety of + * containers in an account (via a {@link BlobServiceClient} object). This type is immutable to ensure thread-safety of * requests, so changing the details for a different listing operation requires construction of a new object. Null may * be passed if none of the options are desirable. */ diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListContainersOptions.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListContainersOptions.java index 19d3e61a2c75..ed6c27b57d90 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListContainersOptions.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListContainersOptions.java @@ -3,10 +3,10 @@ package com.azure.storage.blob.models; -import com.azure.storage.blob.StorageClient; +import com.azure.storage.blob.BlobServiceClient; /** - * Defines options available to configure the behavior of a call to listContainersSegment on a {@link StorageClient} + * Defines options available to configure the behavior of a call to listContainersSegment on a {@link BlobServiceClient} * object. See the constructor for details on each of the options. Null may be passed in place of an object of this * type if no options are desirable. */ diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/package-info.java b/storage/client/blob/src/main/java/com/azure/storage/blob/package-info.java index 6048911e2d09..54ad22687275 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/package-info.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/package-info.java @@ -3,6 +3,6 @@ // Code generated by Microsoft (R) AutoRest Code Generator /** - * Package containing the classes for StorageClient. + * Package containing the classes for BlobServiceClient. */ package com.azure.storage.blob; diff --git a/storage/client/blob/src/samples/java/AzureIdentityExample.java b/storage/client/blob/src/samples/java/com/azure/storage/blob/AzureIdentityExample.java similarity index 89% rename from storage/client/blob/src/samples/java/AzureIdentityExample.java rename to storage/client/blob/src/samples/java/com/azure/storage/blob/AzureIdentityExample.java index 6550c8c02a76..9945273cbccd 100644 --- a/storage/client/blob/src/samples/java/AzureIdentityExample.java +++ b/storage/client/blob/src/samples/java/com/azure/storage/blob/AzureIdentityExample.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +package com.azure.storage.blob; + import com.azure.identity.credential.DefaultAzureCredential; -import com.azure.storage.blob.StorageClient; -import com.azure.storage.blob.StorageClientBuilder; import java.util.Locale; @@ -30,7 +30,7 @@ public static void main(String[] args) { /* * Create a storage client using the Azure Identity credentials. */ - StorageClient storageClient = new StorageClientBuilder() + BlobServiceClient storageClient = new BlobServiceClientBuilder() .endpoint(endpoint) .credential(new DefaultAzureCredential()) .buildClient(); diff --git a/storage/client/blob/src/samples/java/BasicExample.java b/storage/client/blob/src/samples/java/com/azure/storage/blob/BasicExample.java similarity index 91% rename from storage/client/blob/src/samples/java/BasicExample.java rename to storage/client/blob/src/samples/java/com/azure/storage/blob/BasicExample.java index 3f8edbd367cb..c47e753b3f07 100644 --- a/storage/client/blob/src/samples/java/BasicExample.java +++ b/storage/client/blob/src/samples/java/com/azure/storage/blob/BasicExample.java @@ -1,10 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -import com.azure.storage.blob.BlockBlobClient; -import com.azure.storage.blob.ContainerClient; -import com.azure.storage.blob.StorageClient; -import com.azure.storage.blob.StorageClientBuilder; +package com.azure.storage.blob; + import com.azure.storage.common.credentials.SharedKeyCredential; import java.io.ByteArrayInputStream; @@ -46,9 +44,9 @@ public static void main(String[] args) throws IOException { String endpoint = String.format(Locale.ROOT, "https://%s.blob.core.windows.net", accountName); /* - * Create a StorageClient object that wraps the service endpoint, credential and a request pipeline. + * Create a BlobServiceClient object that wraps the service endpoint, credential and a request pipeline. */ - StorageClient storageClient = new StorageClientBuilder().endpoint(endpoint).credential(credential).buildClient(); + BlobServiceClient storageClient = new BlobServiceClientBuilder().endpoint(endpoint).credential(credential).buildClient(); /* * This example shows several common operations just to get you started. diff --git a/storage/client/blob/src/samples/java/com/azure/storage/blob/BlobAsyncClientJavaDocCodeSnippets.java b/storage/client/blob/src/samples/java/com/azure/storage/blob/BlobAsyncClientJavaDocCodeSnippets.java new file mode 100644 index 000000000000..3b82eabc7bcf --- /dev/null +++ b/storage/client/blob/src/samples/java/com/azure/storage/blob/BlobAsyncClientJavaDocCodeSnippets.java @@ -0,0 +1,390 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +import com.azure.storage.blob.models.AccessTier; +import com.azure.storage.blob.models.BlobAccessConditions; +import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobRange; +import com.azure.storage.blob.models.DeleteSnapshotsOptionType; +import com.azure.storage.blob.models.LeaseAccessConditions; +import com.azure.storage.blob.models.Metadata; +import com.azure.storage.blob.models.ModifiedAccessConditions; +import com.azure.storage.blob.models.ReliableDownloadOptions; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.net.URL; +import java.time.OffsetDateTime; +import java.util.Collections; + +/** + * Code snippets for {@link BlobAsyncClient} + */ +@SuppressWarnings("unused") +public class BlobAsyncClientJavaDocCodeSnippets { + private BlobAsyncClient client = JavaDocCodeSnippetsHelpers.getBlobAsyncClient("blobName"); + private String leaseId = "leaseId"; + private String copyId = "copyId"; + private URL url = JavaDocCodeSnippetsHelpers.generateURL("https://sample.com"); + private String file = "file"; + + /** + * Code snippet for {@link BlobAsyncClient#exists()} + */ + public void existsCodeSnippet() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.exists + client.exists().subscribe(response -> System.out.printf("Exists? %b%n", response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.exists + } + + /** + * Code snippets for {@link BlobAsyncClient#startCopyFromURL(URL)} and + * {@link BlobAsyncClient#startCopyFromURL(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions)} + */ + public void startCopyFromURL() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL + client.startCopyFromURL(url) + .subscribe(response -> System.out.printf("Copy identifier: %s%n", response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(7)); + BlobAccessConditions blobAccessConditions = new BlobAccessConditions() + .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); + + client.startCopyFromURL(url, metadata, modifiedAccessConditions, blobAccessConditions) + .subscribe(response -> System.out.printf("Copy identifier: %s%n", response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#abortCopyFromURL(String)} and + * {@link BlobAsyncClient#abortCopyFromURL(String, LeaseAccessConditions)} + */ + public void abortCopyFromURL() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.abortCopyFromURL#String + client.abortCopyFromURL(copyId) + .subscribe(response -> System.out.printf("Aborted copy completed with status %d%n", response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.abortCopyFromURL#String + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.abortCopyFromURL#String-LeaseAccessConditions + LeaseAccessConditions leaseAccessConditions = new LeaseAccessConditions().leaseId(leaseId); + client.abortCopyFromURL(copyId, leaseAccessConditions) + .subscribe(response -> System.out.printf("Aborted copy completed with status %d%n", response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.abortCopyFromURL#String-LeaseAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#copyFromURL(URL)} and + * {@link BlobAsyncClient#copyFromURL(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions)} + */ + public void copyFromURL() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL + client.copyFromURL(url).subscribe(response -> System.out.printf("Copy identifier: %s%n", response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(7)); + BlobAccessConditions blobAccessConditions = new BlobAccessConditions() + .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); + + client.copyFromURL(url, metadata, modifiedAccessConditions, blobAccessConditions) + .subscribe(response -> System.out.printf("Copy identifier: %s%n", response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#download()} and + * {@link BlobAsyncClient#download(BlobRange, ReliableDownloadOptions, BlobAccessConditions, boolean)} + * + * @throws UncheckedIOException If an I/O error occurs + */ + public void download() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.download + client.download().subscribe(response -> { + ByteArrayOutputStream downloadData = new ByteArrayOutputStream(); + response.value().subscribe(piece -> { + try { + downloadData.write(piece.array()); + } catch (IOException ex) { + throw new UncheckedIOException(ex); + } + }); + }); + // END: com.azure.storage.blob.BlobAsyncClient.download + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.download#BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean + BlobRange range = new BlobRange(1024, 2048); + ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5); + + client.download(range, options, null, false).subscribe(response -> { + ByteArrayOutputStream downloadData = new ByteArrayOutputStream(); + response.value().subscribe(piece -> { + try { + downloadData.write(piece.array()); + } catch (IOException ex) { + throw new UncheckedIOException(ex); + } + }); + }); + // END: com.azure.storage.blob.BlobAsyncClient.download#BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean + } + + /** + * Code snippets for {@link BlobAsyncClient#downloadToFile(String)} and + * {@link BlobAsyncClient#downloadToFile(String, BlobRange, Integer, ReliableDownloadOptions, BlobAccessConditions, boolean)} + */ + public void downloadToFile() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.downloadToFile#String + client.downloadToFile(file).subscribe(response -> System.out.println("Completed download to file")); + // END: com.azure.storage.blob.BlobAsyncClient.downloadToFile#String + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean + BlobRange range = new BlobRange(1024, 2048); + ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5); + + client.downloadToFile(file, range, null, options, null, false) + .subscribe(response -> System.out.println("Completed download to file")); + // END: com.azure.storage.blob.BlobAsyncClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean + } + + /** + * Code snippets for {@link BlobAsyncClient#delete()} and + * {@link BlobAsyncClient#delete(DeleteSnapshotsOptionType, BlobAccessConditions)} + */ + public void delete() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.delete + client.delete() + .subscribe(response -> System.out.printf("Delete completed with status %d%n", response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.delete + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.delete#DeleteSnapshotsOptionType-BlobAccessConditions + client.delete(DeleteSnapshotsOptionType.INCLUDE, null) + .subscribe(response -> System.out.printf("Delete completed with status %d%n", response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.delete#DeleteSnapshotsOptionType-BlobAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#getProperties()} and + * {@link BlobAsyncClient#getProperties(BlobAccessConditions)} + */ + public void getProperties() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.getProperties + client.getProperties().subscribe(response -> + System.out.printf("Type: %s, Size: %d%n", response.value().blobType(), response.value().blobSize())); + // END: com.azure.storage.blob.BlobAsyncClient.getProperties + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.getProperties#BlobAccessConditions + BlobAccessConditions accessConditions = new BlobAccessConditions() + .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); + + client.getProperties(accessConditions).subscribe(response -> + System.out.printf("Type: %s, Size: %d%n", response.value().blobType(), response.value().blobSize())); + // END: com.azure.storage.blob.BlobAsyncClient.getProperties#BlobAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#setHTTPHeaders(BlobHTTPHeaders)} and + * {@link BlobAsyncClient#setHTTPHeaders(BlobHTTPHeaders, BlobAccessConditions)} + */ + public void setHTTPHeaders() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.setHTTPHeaders#BlobHTTPHeaders + client.setHTTPHeaders(new BlobHTTPHeaders() + .blobContentLanguage("en-US") + .blobContentType("binary")).subscribe(response -> + System.out.printf("Set HTTP headers completed with status %d%n", response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.setHTTPHeaders#BlobHTTPHeaders + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions + BlobAccessConditions accessConditions = new BlobAccessConditions() + .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); + + client.setHTTPHeaders(new BlobHTTPHeaders() + .blobContentLanguage("en-US") + .blobContentType("binary"), accessConditions).subscribe(response -> + System.out.printf("Set HTTP headers completed with status %d%n", response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#setMetadata(Metadata)} and + * {@link BlobAsyncClient#setMetadata(Metadata, BlobAccessConditions)} + */ + public void setMetadata() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.setMetadata#Metadata + client.setMetadata(new Metadata(Collections.singletonMap("metadata", "value"))) + .subscribe(response -> System.out.printf("Set metadata completed with status %d%n", response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.setMetadata#Metadata + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.setMetadata#Metadata-BlobAccessConditions + BlobAccessConditions accessConditions = new BlobAccessConditions() + .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); + + client.setMetadata(new Metadata(Collections.singletonMap("metadata", "value")), accessConditions) + .subscribe(response -> System.out.printf("Set metadata completed with status %d%n", response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.setMetadata#Metadata-BlobAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#createSnapshot()} and + * {@link BlobAsyncClient#createSnapshot(Metadata, BlobAccessConditions)} + */ + public void createSnapshot() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.createSnapshot + client.createSnapshot() + .subscribe(response -> System.out.printf("Identifier for the snapshot is %s%n", response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.createSnapshot + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.createSnapshot#Metadata-BlobAccessConditions + Metadata snapshotMetadata = new Metadata(Collections.singletonMap("metadata", "value")); + BlobAccessConditions accessConditions = new BlobAccessConditions() + .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); + + client.createSnapshot(snapshotMetadata, accessConditions) + .subscribe(response -> System.out.printf("Identifier for the snapshot is %s%n", response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.createSnapshot#Metadata-BlobAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#setTier(AccessTier)} and + * {@link BlobAsyncClient#setTier(AccessTier, LeaseAccessConditions)} + */ + public void setTier() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.setTier#AccessTier + client.setTier(AccessTier.HOT) + .subscribe(response -> System.out.printf("Set tier completed with status code %d%n", response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.setTier#AccessTier + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.setTier#AccessTier-LeaseAccessConditions + LeaseAccessConditions accessConditions = new LeaseAccessConditions().leaseId(leaseId); + + client.setTier(AccessTier.HOT, accessConditions) + .subscribe(response -> System.out.printf("Set tier completed with status code %d%n", response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.setTier#AccessTier-LeaseAccessConditions + } + + /** + * Code snippet for {@link BlobAsyncClient#undelete()} + */ + public void undelete() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.undelete + client.undelete() + .subscribe(response -> System.out.printf("Undelete completed with status %d%n", response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.undelete + } + + /** + * Code snippets for {@link BlobAsyncClient#acquireLease(String, int)} and + * {@link BlobAsyncClient#acquireLease(String, int, ModifiedAccessConditions)} + */ + public void acquireLease() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int + client.acquireLease("proposedId", 60) + .subscribe(response -> System.out.printf("Lease ID is %s%n", response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int-ModifiedAccessConditions + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifModifiedSince(OffsetDateTime.now().minusDays(3)); + + client.acquireLease("proposedId", 60, modifiedAccessConditions) + .subscribe(response -> System.out.printf("Lease ID is %s%n", response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int-ModifiedAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#renewLease(String)} and + * {@link BlobAsyncClient#renewLease(String, ModifiedAccessConditions)} + */ + public void renewLease() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.renewLease#String + client.renewLease(leaseId) + .subscribe(response -> System.out.printf("Renewed lease ID is %s%n", response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.renewLease#String + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.renewLease#String-ModifiedAccessConditions + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + client.renewLease(leaseId, modifiedAccessConditions) + .subscribe(response -> System.out.printf("Renewed lease ID is %s%n", response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.renewLease#String-ModifiedAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#releaseLease(String)} and + * {@link BlobAsyncClient#releaseLease(String, ModifiedAccessConditions)} + */ + public void releaseLease() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.releaseLease#String + client.releaseLease(leaseId) + .subscribe(response -> System.out.printf("Release lease completed with status %d%n", response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.releaseLease#String + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.releaseLease#String-ModifiedAccessConditions + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + client.releaseLease(leaseId, modifiedAccessConditions) + .subscribe(response -> System.out.printf("Release lease completed with status %d%n", response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.releaseLease#String-ModifiedAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#breakLease()} and + * {@link BlobAsyncClient#breakLease(Integer, ModifiedAccessConditions)} + */ + public void breakLease() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.breakLease + client.breakLease() + .subscribe(response -> + System.out.printf("The broken lease has %d seconds remaining on the lease", response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.breakLease + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.breakLease#Integer-ModifiedAccessConditions + Integer retainLeaseInSeconds = 5; + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + client.breakLease(retainLeaseInSeconds, modifiedAccessConditions) + .subscribe(response -> + System.out.printf("The broken lease has %d seconds remaining on the lease", response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.breakLease#Integer-ModifiedAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#changeLease(String, String)} and + * {@link BlobAsyncClient#changeLease(String, String, ModifiedAccessConditions)} + */ + public void changeLease() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.changeLease#String-String + client.changeLease(leaseId, "proposedId") + .subscribe(response -> System.out.printf("Changed lease ID is %s%n", response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.changeLease#String-String + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.changeLease#String-String-ModifiedAccessConditions + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + client.changeLease(leaseId, "proposedId", modifiedAccessConditions) + .subscribe(response -> System.out.printf("Changed lease ID is %s%n", response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.changeLease#String-String-ModifiedAccessConditions + } + + /** + * Code snippet for {@link BlobAsyncClient#getAccountInfo()} + */ + public void getAccountInfo() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.getAccountInfo + client.getAccountInfo().subscribe(response -> System.out.printf("Account Kind: %s, SKU: %s%n", + response.value().accountKind(), response.value().skuName())); + // END: com.azure.storage.blob.BlobAsyncClient.getAccountInfo + } +} diff --git a/storage/client/blob/src/samples/java/com/azure/storage/blob/BlobClientJavaDocCodeSnippets.java b/storage/client/blob/src/samples/java/com/azure/storage/blob/BlobClientJavaDocCodeSnippets.java new file mode 100644 index 000000000000..d99b83f910ad --- /dev/null +++ b/storage/client/blob/src/samples/java/com/azure/storage/blob/BlobClientJavaDocCodeSnippets.java @@ -0,0 +1,387 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +import com.azure.storage.blob.models.AccessTier; +import com.azure.storage.blob.models.BlobAccessConditions; +import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobRange; +import com.azure.storage.blob.models.DeleteSnapshotsOptionType; +import com.azure.storage.blob.models.LeaseAccessConditions; +import com.azure.storage.blob.models.Metadata; +import com.azure.storage.blob.models.ModifiedAccessConditions; +import com.azure.storage.blob.models.ReliableDownloadOptions; +import com.azure.storage.blob.models.StorageAccountInfo; + +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; +import java.net.URL; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Collections; + +/** + * Code snippets for {@link BlobClient} + */ +@SuppressWarnings("unused") +public class BlobClientJavaDocCodeSnippets { + private BlobClient client = JavaDocCodeSnippetsHelpers.getBlobClient("blobName"); + private String leaseId = "leaseId"; + private String copyId = "copyId"; + private URL url = JavaDocCodeSnippetsHelpers.generateURL("https://sample.com"); + private String file = "file"; + private Duration timeout = Duration.ofSeconds(30); + + /** + * Code snippets for {@link BlobClient#exists()} and {@link BlobClient#exists(Duration)} + */ + public void existsCodeSnippet() { + // BEGIN: com.azure.storage.blob.BlobClient.exists + System.out.printf("Exists? %b%n", client.exists().value()); + // END: com.azure.storage.blob.BlobClient.exists + + // BEGIN: com.azure.storage.blob.BlobClient.exists#Duration + System.out.printf("Exists? %b%n", client.exists(timeout).value()); + // END: com.azure.storage.blob.BlobClient.exists#Duration + } + + /** + * Code snippets for {@link BlobClient#startCopyFromURL(URL)} and + * {@link BlobClient#startCopyFromURL(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions, Duration)} + */ + public void startCopyFromURL() { + // BEGIN: com.azure.storage.blob.BlobClient.startCopyFromURL#URL + System.out.printf("Copy identifier: %s%n", client.startCopyFromURL(url).value()); + // END: com.azure.storage.blob.BlobClient.startCopyFromURL#URL + + // BEGIN: com.azure.storage.blob.BlobClient.startCopyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(7)); + BlobAccessConditions blobAccessConditions = new BlobAccessConditions() + .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); + + System.out.printf("Copy identifier: %s%n", + client.startCopyFromURL(url, metadata, modifiedAccessConditions, blobAccessConditions, timeout)); + // END: com.azure.storage.blob.BlobClient.startCopyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration + } + + /** + * Code snippets for {@link BlobClient#abortCopyFromURL(String)} and + * {@link BlobClient#abortCopyFromURL(String, LeaseAccessConditions, Duration)} + */ + public void abortCopyFromURL() { + // BEGIN: com.azure.storage.blob.BlobClient.abortCopyFromURL#String + System.out.printf("Aborted copy completed with status %d%n", client.abortCopyFromURL(copyId).statusCode()); + // END: com.azure.storage.blob.BlobClient.abortCopyFromURL#String + + // BEGIN: com.azure.storage.blob.BlobClient.abortCopyFromURL#String-LeaseAccessConditions-Duration + LeaseAccessConditions leaseAccessConditions = new LeaseAccessConditions().leaseId(leaseId); + System.out.printf("Aborted copy completed with status %d%n", + client.abortCopyFromURL(copyId, leaseAccessConditions, timeout).statusCode()); + // END: com.azure.storage.blob.BlobClient.abortCopyFromURL#String-LeaseAccessConditions-Duration + } + + /** + * Code snippets for {@link BlobClient#copyFromURL(URL)} and + * {@link BlobClient#copyFromURL(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions, Duration)} + */ + public void copyFromURL() { + // BEGIN: com.azure.storage.blob.BlobClient.copyFromURL#URL + System.out.printf("Copy identifier: %s%n", client.copyFromURL(url).value()); + // END: com.azure.storage.blob.BlobClient.copyFromURL#URL + + // BEGIN: com.azure.storage.blob.BlobClient.copyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(7)); + BlobAccessConditions blobAccessConditions = new BlobAccessConditions() + .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); + + System.out.printf("Copy identifier: %s%n", + client.copyFromURL(url, metadata, modifiedAccessConditions, blobAccessConditions, timeout).value()); + // END: com.azure.storage.blob.BlobClient.copyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration + } + + /** + * Code snippets for {@link BlobClient#download(OutputStream)} and + * {@link BlobClient#download(OutputStream, BlobRange, ReliableDownloadOptions, BlobAccessConditions, boolean, Duration)} + */ + public void download() { + // BEGIN: com.azure.storage.blob.BlobClient.download#OutputStream + System.out.printf("Download completed with status %d%n", + client.download(new ByteArrayOutputStream()).statusCode()); + // END: com.azure.storage.blob.BlobClient.download#OutputStream + + // BEGIN: com.azure.storage.blob.BlobClient.download#OutputStream-BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration + BlobRange range = new BlobRange(1024, 2048); + ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5); + + System.out.printf("Download completed with status %d%n", + client.download(new ByteArrayOutputStream(), range, options, null, false, timeout).statusCode()); + // END: com.azure.storage.blob.BlobClient.download#OutputStream-BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration + } + + /** + * Code snippets for {@link BlobClient#downloadToFile(String)} and + * {@link BlobClient#downloadToFile(String, BlobRange, Integer, ReliableDownloadOptions, BlobAccessConditions, boolean, Duration)} + */ + public void downloadToFile() { + // BEGIN: com.azure.storage.blob.BlobClient.downloadToFile#String + client.downloadToFile(file); + System.out.println("Completed download to file"); + // END: com.azure.storage.blob.BlobClient.downloadToFile#String + + // BEGIN: com.azure.storage.blob.BlobClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration + BlobRange range = new BlobRange(1024, 2048); + ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5); + + client.downloadToFile(file, range, null, options, null, false, timeout); + System.out.println("Completed download to file"); + // END: com.azure.storage.blob.BlobClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration + } + + /** + * Code snippets for {@link BlobClient#delete()} and + * {@link BlobClient#delete(DeleteSnapshotsOptionType, BlobAccessConditions, Duration)} + */ + public void delete() { + // BEGIN: com.azure.storage.blob.BlobClient.delete + System.out.printf("Delete completed with status %d%n", client.delete().statusCode()); + // END: com.azure.storage.blob.BlobClient.delete + + // BEGIN: com.azure.storage.blob.BlobClient.delete#DeleteSnapshotsOptionType-BlobAccessConditions-Duration + System.out.printf("Delete completed with status %d%n", + client.delete(DeleteSnapshotsOptionType.INCLUDE, null, timeout).statusCode()); + // END: com.azure.storage.blob.BlobClient.delete#DeleteSnapshotsOptionType-BlobAccessConditions-Duration + } + + /** + * Code snippets for {@link BlobClient#getProperties()} + */ + public void getProperties() { + // BEGIN: com.azure.storage.blob.BlobClient.getProperties + BlobProperties properties = client.getProperties().value(); + System.out.printf("Type: %s, Size: %d%n", properties.blobType(), properties.blobSize()); + // END: com.azure.storage.blob.BlobClient.getProperties + } + + /** + * Code snippet for {@link BlobClient#getProperties(BlobAccessConditions, Duration)} + */ + public void getPropertiesWithTimeout() { + // BEGIN: com.azure.storage.blob.BlobClient.getProperties#BlobAccessConditions-Duration + BlobAccessConditions accessConditions = new BlobAccessConditions() + .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); + + BlobProperties properties = client.getProperties(accessConditions, timeout).value(); + System.out.printf("Type: %s, Size: %d%n", properties.blobType(), properties.blobSize()); + // END: com.azure.storage.blob.BlobClient.getProperties#BlobAccessConditions-Duration + } + + /** + * Code snippets for {@link BlobClient#setHTTPHeaders(BlobHTTPHeaders)} and + * {@link BlobClient#setHTTPHeaders(BlobHTTPHeaders, BlobAccessConditions, Duration)} + */ + public void setHTTPHeaders() { + // BEGIN: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders + System.out.printf("Set HTTP headers completed with status %d%n", + client.setHTTPHeaders(new BlobHTTPHeaders() + .blobContentLanguage("en-US") + .blobContentType("binary")) + .statusCode()); + // END: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders + + // BEGIN: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions-Duration + BlobAccessConditions accessConditions = new BlobAccessConditions() + .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); + + System.out.printf("Set HTTP headers completed with status %d%n", + client.setHTTPHeaders(new BlobHTTPHeaders() + .blobContentLanguage("en-US") + .blobContentType("binary"), accessConditions, timeout) + .statusCode()); + // END: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions-Duration + } + + /** + * Code snippets for {@link BlobClient#setMetadata(Metadata)} and + * {@link BlobClient#setMetadata(Metadata, BlobAccessConditions, Duration)} + */ + public void setMetadata() { + // BEGIN: com.azure.storage.blob.BlobClient.setMetadata#Metadata + System.out.printf("Set metadata completed with status %d%n", + client.setMetadata(new Metadata(Collections.singletonMap("metadata", "value"))).statusCode()); + // END: com.azure.storage.blob.BlobClient.setMetadata#Metadata + + // BEGIN: com.azure.storage.blob.BlobClient.setMetadata#Metadata-BlobAccessConditions-Duration + BlobAccessConditions accessConditions = new BlobAccessConditions() + .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); + + System.out.printf("Set metadata completed with status %d%n", + client.setMetadata( + new Metadata(Collections.singletonMap("metadata", "value")), accessConditions, timeout).statusCode()); + // END: com.azure.storage.blob.BlobClient.setMetadata#Metadata-BlobAccessConditions-Duration + } + + /** + * Code snippets for {@link BlobClient#createSnapshot()} and + * {@link BlobClient#createSnapshot(Metadata, BlobAccessConditions, Duration)} + */ + public void createSnapshot() { + // BEGIN: com.azure.storage.blob.BlobClient.createSnapshot + System.out.printf("Identifier for the snapshot is %s%n", client.createSnapshot().value()); + // END: com.azure.storage.blob.BlobClient.createSnapshot + + // BEGIN: com.azure.storage.blob.BlobClient.createSnapshot#Metadata-BlobAccessConditions-Duration + Metadata snapshotMetadata = new Metadata(Collections.singletonMap("metadata", "value")); + BlobAccessConditions accessConditions = new BlobAccessConditions() + .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); + + System.out.printf("Identifier for the snapshot is %s%n", + client.createSnapshot(snapshotMetadata, accessConditions, timeout).value()); + // END: com.azure.storage.blob.BlobClient.createSnapshot#Metadata-BlobAccessConditions-Duration + } + + /** + * Code snippets for {@link BlobClient#setTier(AccessTier)} and + * {@link BlobClient#setTier(AccessTier, LeaseAccessConditions, Duration)} + */ + public void setTier() { + // BEGIN: com.azure.storage.blob.BlobClient.setTier#AccessTier + System.out.printf("Set tier completed with status code %d%n", client.setTier(AccessTier.HOT).statusCode()); + // END: com.azure.storage.blob.BlobClient.setTier#AccessTier + + // BEGIN: com.azure.storage.blob.BlobClient.setTier#AccessTier-LeaseAccessConditions-Duration + LeaseAccessConditions accessConditions = new LeaseAccessConditions().leaseId(leaseId); + + System.out.printf("Set tier completed with status code %d%n", + client.setTier(AccessTier.HOT, accessConditions, timeout).statusCode()); + // END: com.azure.storage.blob.BlobClient.setTier#AccessTier-LeaseAccessConditions-Duration + } + + /** + * Code snippets for {@link BlobClient#undelete()} and {@link BlobClient#undelete(Duration)} + */ + public void undelete() { + // BEGIN: com.azure.storage.blob.BlobClient.undelete + System.out.printf("Undelete completed with status %d%n", client.undelete().statusCode()); + // END: com.azure.storage.blob.BlobClient.undelete + + // BEGIN: com.azure.storage.blob.BlobClient.undelete#Duration + System.out.printf("Undelete completed with status %d%n", client.undelete(timeout).statusCode()); + // END: com.azure.storage.blob.BlobClient.undelete#Duration + } + + /** + * Code snippets for {@link BlobClient#acquireLease(String, int)} and + * {@link BlobClient#acquireLease(String, int, ModifiedAccessConditions, Duration)} + */ + public void acquireLease() { + // BEGIN: com.azure.storage.blob.BlobClient.acquireLease#String-int + System.out.printf("Lease ID is %s%n", client.acquireLease("proposedId", 60).value()); + // END: com.azure.storage.blob.BlobClient.acquireLease#String-int + + // BEGIN: com.azure.storage.blob.BlobClient.acquireLease#String-int-ModifiedAccessConditions-Duration + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifModifiedSince(OffsetDateTime.now().minusDays(3)); + + System.out.printf("Lease ID is %s%n", + client.acquireLease("proposedId", 60, modifiedAccessConditions, timeout).value()); + // END: com.azure.storage.blob.BlobClient.acquireLease#String-int-ModifiedAccessConditions-Duration + } + + /** + * Code snippets for {@link BlobClient#renewLease(String)} and + * {@link BlobClient#renewLease(String, ModifiedAccessConditions, Duration)} + */ + public void renewLease() { + // BEGIN: com.azure.storage.blob.BlobClient.renewLease#String + System.out.printf("Renewed lease ID is %s%n", client.renewLease(leaseId).value()); + // END: com.azure.storage.blob.BlobClient.renewLease#String + + // BEGIN: com.azure.storage.blob.BlobClient.renewLease#String-ModifiedAccessConditions-Duration + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + System.out.printf("Renewed lease ID is %s%n", + client.renewLease(leaseId, modifiedAccessConditions, timeout).value()); + // END: com.azure.storage.blob.BlobClient.renewLease#String-ModifiedAccessConditions-Duration + } + + /** + * Code snippets for {@link BlobClient#releaseLease(String)} and + * {@link BlobClient#releaseLease(String, ModifiedAccessConditions, Duration)} + */ + public void releaseLease() { + // BEGIN: com.azure.storage.blob.BlobClient.releaseLease#String + System.out.printf("Release lease completed with status %d%n", client.releaseLease(leaseId).statusCode()); + // END: com.azure.storage.blob.BlobClient.releaseLease#String + + // BEGIN: com.azure.storage.blob.BlobClient.releaseLease#String-ModifiedAccessConditions-Duration + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + System.out.printf("Release lease completed with status %d%n", + client.releaseLease(leaseId, modifiedAccessConditions, timeout).statusCode()); + // END: com.azure.storage.blob.BlobClient.releaseLease#String-ModifiedAccessConditions-Duration + } + + /** + * Code snippets for {@link BlobClient#breakLease()} and + * {@link BlobClient#breakLease(Integer, ModifiedAccessConditions, Duration)} + */ + public void breakLease() { + // BEGIN: com.azure.storage.blob.BlobClient.breakLease + System.out.printf("The broken lease has %d seconds remaining on the lease", client.breakLease().value()); + // END: com.azure.storage.blob.BlobClient.breakLease + + // BEGIN: com.azure.storage.blob.BlobClient.breakLease#Integer-ModifiedAccessConditions-Duration + Integer retainLeaseInSeconds = 5; + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + System.out.printf("The broken lease has %d seconds remaining on the lease", + client.breakLease(retainLeaseInSeconds, modifiedAccessConditions, timeout).value()); + // END: com.azure.storage.blob.BlobClient.breakLease#Integer-ModifiedAccessConditions-Duration + } + + /** + * Code snippets for {@link BlobClient#changeLease(String, String)} and + * {@link BlobClient#changeLease(String, String, ModifiedAccessConditions, Duration)} + */ + public void changeLease() { + // BEGIN: com.azure.storage.blob.BlobClient.changeLease#String-String + System.out.printf("Changed lease ID is %s%n", client.changeLease(leaseId, "proposedId").value()); + // END: com.azure.storage.blob.BlobClient.changeLease#String-String + + // BEGIN: com.azure.storage.blob.BlobClient.changeLease#String-String-ModifiedAccessConditions-Duration + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + System.out.printf("Changed lease ID is %s%n", + client.changeLease(leaseId, "proposedId", modifiedAccessConditions, timeout).value()); + // END: com.azure.storage.blob.BlobClient.changeLease#String-String-ModifiedAccessConditions-Duration + } + + /** + * Code snippet for {@link BlobClient#getAccountInfo()} + */ + public void getAccountInfo() { + // BEGIN: com.azure.storage.blob.BlobClient.getAccountInfo + StorageAccountInfo accountInfo = client.getAccountInfo().value(); + System.out.printf("Account Kind: %s, SKU: %s%n", accountInfo.accountKind(), accountInfo.skuName()); + // END: com.azure.storage.blob.BlobClient.getAccountInfo + } + + /** + * Code snippet for {@link BlobClient#getAccountInfo(Duration)} + */ + public void getAccountInfoWithTimeout() { + // BEGIN: com.azure.storage.blob.BlobClient.getAccountInfo#Duration + StorageAccountInfo accountInfo = client.getAccountInfo(timeout).value(); + System.out.printf("Account Kind: %s, SKU: %s%n", accountInfo.accountKind(), accountInfo.skuName()); + // END: com.azure.storage.blob.BlobClient.getAccountInfo#Duration + } +} diff --git a/storage/client/blob/src/samples/java/FileTransferExample.java b/storage/client/blob/src/samples/java/com/azure/storage/blob/FileTransferExample.java similarity index 93% rename from storage/client/blob/src/samples/java/FileTransferExample.java rename to storage/client/blob/src/samples/java/com/azure/storage/blob/FileTransferExample.java index cfd281c1e3f8..33886cd10750 100644 --- a/storage/client/blob/src/samples/java/FileTransferExample.java +++ b/storage/client/blob/src/samples/java/com/azure/storage/blob/FileTransferExample.java @@ -1,10 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -import com.azure.storage.blob.BlockBlobClient; -import com.azure.storage.blob.ContainerClient; -import com.azure.storage.blob.StorageClient; -import com.azure.storage.blob.StorageClientBuilder; +package com.azure.storage.blob; + import com.azure.storage.common.credentials.SharedKeyCredential; import java.io.File; @@ -52,10 +50,10 @@ public static void main(String[] args) throws IOException, NoSuchAlgorithmExcept String endPoint = String.format(Locale.ROOT, "https://%s.blob.core.windows.net", accountName); /* - * Create a StorageClient object that wraps the service endpoint, credential and a request pipeline. + * Create a BlobServiceClient object that wraps the service endpoint, credential and a request pipeline. * Now you can use the storageClient to perform various container and blob operations. */ - StorageClient storageClient = new StorageClientBuilder().endpoint(endPoint).credential(credential).buildClient(); + BlobServiceClient storageClient = new BlobServiceClientBuilder().endpoint(endPoint).credential(credential).buildClient(); /* diff --git a/storage/client/blob/src/samples/java/com/azure/storage/blob/JavaDocCodeSnippetsHelpers.java b/storage/client/blob/src/samples/java/com/azure/storage/blob/JavaDocCodeSnippetsHelpers.java new file mode 100644 index 000000000000..febf2861cad9 --- /dev/null +++ b/storage/client/blob/src/samples/java/com/azure/storage/blob/JavaDocCodeSnippetsHelpers.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +import java.net.MalformedURLException; +import java.net.URL; + +final class JavaDocCodeSnippetsHelpers { + static ContainerAsyncClient getContainerAsyncClient() { + return new ContainerClientBuilder().buildAsyncClient(); + } + + static BlobAsyncClient getBlobAsyncClient(String blobName) { + return getContainerAsyncClient().getBlobAsyncClient(blobName); + } + + static BlobClient getBlobClient(String blobName) { + return new BlobClient(getBlobAsyncClient(blobName)); + } + + static URL generateURL(String urlString) { + try { + return new URL(urlString); + } catch (MalformedURLException ex) { + throw new RuntimeException(ex); + } + } +} diff --git a/storage/client/blob/src/samples/java/ListContainersExample.java b/storage/client/blob/src/samples/java/com/azure/storage/blob/ListContainersExample.java similarity index 84% rename from storage/client/blob/src/samples/java/ListContainersExample.java rename to storage/client/blob/src/samples/java/com/azure/storage/blob/ListContainersExample.java index ab8c9b3709bc..5588ef64241c 100644 --- a/storage/client/blob/src/samples/java/ListContainersExample.java +++ b/storage/client/blob/src/samples/java/com/azure/storage/blob/ListContainersExample.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -import com.azure.storage.blob.StorageClient; -import com.azure.storage.blob.StorageClientBuilder; +package com.azure.storage.blob; + import com.azure.storage.common.credentials.SharedKeyCredential; import java.util.Locale; @@ -32,9 +32,9 @@ public static void main(String[] args) { String endpoint = String.format(Locale.ROOT, "https://%s.blob.core.windows.net", accountName); /* - * Create a StorageClient object that wraps the service endpoint, credential and a request pipeline. + * Create a BlobServiceClient object that wraps the service endpoint, credential and a request pipeline. */ - StorageClient storageClient = new StorageClientBuilder().endpoint(endpoint).credential(credential).buildClient(); + BlobServiceClient storageClient = new BlobServiceClientBuilder().endpoint(endpoint).credential(credential).buildClient(); /* * Create 3 different containers from the storageClient. diff --git a/storage/client/blob/src/samples/java/SampleHelper.java b/storage/client/blob/src/samples/java/com/azure/storage/blob/SampleHelper.java similarity index 94% rename from storage/client/blob/src/samples/java/SampleHelper.java rename to storage/client/blob/src/samples/java/com/azure/storage/blob/SampleHelper.java index d841413f06bc..f72655d856bd 100644 --- a/storage/client/blob/src/samples/java/SampleHelper.java +++ b/storage/client/blob/src/samples/java/com/azure/storage/blob/SampleHelper.java @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +package com.azure.storage.blob; + import com.azure.core.util.configuration.ConfigurationManager; /** diff --git a/storage/client/blob/src/samples/java/SetMetadataAndHTTPHeadersExample.java b/storage/client/blob/src/samples/java/com/azure/storage/blob/SetMetadataAndHTTPHeadersExample.java similarity index 87% rename from storage/client/blob/src/samples/java/SetMetadataAndHTTPHeadersExample.java rename to storage/client/blob/src/samples/java/com/azure/storage/blob/SetMetadataAndHTTPHeadersExample.java index 6b475499eab2..591e78141f70 100644 --- a/storage/client/blob/src/samples/java/SetMetadataAndHTTPHeadersExample.java +++ b/storage/client/blob/src/samples/java/com/azure/storage/blob/SetMetadataAndHTTPHeadersExample.java @@ -1,10 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -import com.azure.storage.blob.BlockBlobClient; -import com.azure.storage.blob.ContainerClient; -import com.azure.storage.blob.StorageClient; -import com.azure.storage.blob.StorageClientBuilder; +package com.azure.storage.blob; + import com.azure.storage.blob.models.BlobHTTPHeaders; import com.azure.storage.blob.models.Metadata; import com.azure.storage.common.credentials.SharedKeyCredential; @@ -42,9 +40,9 @@ public static void main(String[] args) throws IOException { String endpoint = String.format(Locale.ROOT, "https://%s.blob.core.windows.net", accountName); /* - * Create a StorageClient object that wraps the service endpoint, credential and a request pipeline. + * Create a BlobServiceClient object that wraps the service endpoint, credential and a request pipeline. */ - StorageClient storageClient = new StorageClientBuilder().endpoint(endpoint).credential(credential).buildClient(); + BlobServiceClient storageClient = new BlobServiceClientBuilder().endpoint(endpoint).credential(credential).buildClient(); /* * Create a container client from storageClient. diff --git a/storage/client/blob/src/samples/java/StorageErrorHandlingExample.java b/storage/client/blob/src/samples/java/com/azure/storage/blob/StorageErrorHandlingExample.java similarity index 94% rename from storage/client/blob/src/samples/java/StorageErrorHandlingExample.java rename to storage/client/blob/src/samples/java/com/azure/storage/blob/StorageErrorHandlingExample.java index 50d4e81d600c..3a84d7026f7b 100644 --- a/storage/client/blob/src/samples/java/StorageErrorHandlingExample.java +++ b/storage/client/blob/src/samples/java/com/azure/storage/blob/StorageErrorHandlingExample.java @@ -1,10 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +package com.azure.storage.blob; + import com.azure.core.http.HttpResponse; -import com.azure.storage.blob.ContainerClient; -import com.azure.storage.blob.ContainerClientBuilder; -import com.azure.storage.blob.StorageException; import com.azure.storage.blob.models.StorageErrorCode; /** diff --git a/storage/client/blob/src/test/java/com/azure/storage/blob/APISpec.groovy b/storage/client/blob/src/test/java/com/azure/storage/blob/APISpec.groovy index daf12f13fb8e..abac9b167e18 100644 --- a/storage/client/blob/src/test/java/com/azure/storage/blob/APISpec.groovy +++ b/storage/client/blob/src/test/java/com/azure/storage/blob/APISpec.groovy @@ -56,7 +56,7 @@ class APISpec extends Specification { static defaultDataSize = defaultData.remaining() // If debugging is enabled, recordings cannot run as there can only be one proxy at a time. - static boolean enableDebugging = true + static boolean enableDebugging = false // Prefixes for blobs and containers static String containerPrefix = "jtc" // java test container @@ -98,16 +98,16 @@ class APISpec extends Specification { /* URLs to various kinds of accounts. */ - StorageClient primaryServiceURL + BlobServiceClient primaryServiceURL @Shared - static StorageClient alternateServiceURL + static BlobServiceClient alternateServiceURL @Shared - static StorageClient blobStorageServiceURL + static BlobServiceClient blobStorageServiceURL @Shared - static StorageClient premiumServiceURL + static BlobServiceClient premiumServiceURL /* Constants for testing that the context parameter is properly passed to the pipeline. @@ -195,10 +195,10 @@ class APISpec extends Specification { } } - static StorageClient getGenericServiceURL(SharedKeyCredential creds) { + static BlobServiceClient getGenericServiceURL(SharedKeyCredential creds) { // TODO: logging? - return new StorageClientBuilder() + return new BlobServiceClientBuilder() .endpoint("https://" + creds.accountName() + ".blob.core.windows.net") .httpClient(getHttpClient()) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) @@ -207,7 +207,7 @@ class APISpec extends Specification { } static void cleanupContainers() throws MalformedURLException { - StorageClient serviceURL = new StorageClientBuilder() + BlobServiceClient serviceURL = new BlobServiceClientBuilder() .endpoint("http://" + primaryCreds.accountName() + ".blob.core.windows.net") .credential(primaryCreds) .buildClient() @@ -556,7 +556,7 @@ class APISpec extends Specification { } def getOAuthServiceURL() { - return new StorageClientBuilder() + return new BlobServiceClientBuilder() .endpoint(String.format("https://%s.blob.core.windows.net/", primaryCreds.accountName())) .credential(new EnvironmentCredential()) // AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET .buildClient() diff --git a/storage/client/blob/src/test/java/com/azure/storage/blob/AadLoginTest.java b/storage/client/blob/src/test/java/com/azure/storage/blob/AadLoginTest.java index 3c2ee324d196..b284e65beb8c 100644 --- a/storage/client/blob/src/test/java/com/azure/storage/blob/AadLoginTest.java +++ b/storage/client/blob/src/test/java/com/azure/storage/blob/AadLoginTest.java @@ -11,11 +11,11 @@ public class AadLoginTest { private static final Random RANDOM = new Random(); - private static StorageClient storageClient; + private static BlobServiceClient storageClient; @BeforeClass public static void setup() { - storageClient = new StorageClientBuilder() + storageClient = new BlobServiceClientBuilder() .endpoint("https://" + System.getenv("ACCOUNT_NAME") + ".blob.core.windows.net") .credential(new EnvironmentCredential()) // .httpClient(HttpClient.createDefault().proxy(() -> new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888)))) diff --git a/storage/client/blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy b/storage/client/blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy index d0be4d532642..5c1bd1178736 100644 --- a/storage/client/blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy +++ b/storage/client/blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy @@ -138,7 +138,7 @@ class BlobAPITest extends APISpec { when: def outStream = new ByteArrayOutputStream() - bu.download(outStream, null, range, null, false, null) + bu.download(outStream, range, null, null, false, null) String bodyStr = outStream.toString() then: @@ -208,7 +208,7 @@ class BlobAPITest extends APISpec { def "Download md5"() { when: - VoidResponse response = bu.download(new ByteArrayOutputStream(), null, new BlobRange(0 ,3), null, true, null) + VoidResponse response = bu.download(new ByteArrayOutputStream(), new BlobRange(0 ,3), null, null, true, null) byte[] contentMD5 = response.headers().value("content-md5").getBytes() then: @@ -1872,7 +1872,7 @@ class BlobAPITest extends APISpec { def "Get account info error"() { when: - StorageClient serviceURL = new StorageClientBuilder() + BlobServiceClient serviceURL = new BlobServiceClientBuilder() .endpoint(primaryServiceURL.getAccountUrl().toString()) .buildClient() serviceURL.getContainerClient(generateContainerName()).getBlobClient(generateBlobName()) diff --git a/storage/client/blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.java b/storage/client/blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.java index 7ebc5e8487cf..e7955c9b7be9 100644 --- a/storage/client/blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.java +++ b/storage/client/blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.java @@ -17,12 +17,12 @@ public class BlobOutputStreamTest { private static final Random RANDOM = new Random(); - private static StorageClient storageClient; + private static BlobServiceClient storageClient; private static ContainerClient containerClient; @BeforeClass public static void setup() { - storageClient = new StorageClientBuilder() + storageClient = new BlobServiceClientBuilder() .endpoint("https://" + System.getenv("ACCOUNT_NAME") + ".blob.core.windows.net") .credential(new SharedKeyCredential(System.getenv("ACCOUNT_NAME"), System.getenv("ACCOUNT_KEY"))) // .httpClient(HttpClient.createDefault().proxy(() -> new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888)))) diff --git a/storage/client/blob/src/test/java/com/azure/storage/blob/ContainerAPITest.groovy b/storage/client/blob/src/test/java/com/azure/storage/blob/ContainerAPITest.groovy index 86da9838d53b..f82f1d4220eb 100644 --- a/storage/client/blob/src/test/java/com/azure/storage/blob/ContainerAPITest.groovy +++ b/storage/client/blob/src/test/java/com/azure/storage/blob/ContainerAPITest.groovy @@ -1624,7 +1624,7 @@ class ContainerAPITest extends APISpec { def "Get account info error"() { when: - StorageClient serviceURL = new StorageClientBuilder() + BlobServiceClient serviceURL = new BlobServiceClientBuilder() .endpoint(primaryServiceURL.getAccountUrl().toString()) .buildClient() diff --git a/storage/client/blob/src/test/java/com/azure/storage/blob/LargeFileTest.java b/storage/client/blob/src/test/java/com/azure/storage/blob/LargeFileTest.java index a692d6d4c3c3..8bff57d55951 100644 --- a/storage/client/blob/src/test/java/com/azure/storage/blob/LargeFileTest.java +++ b/storage/client/blob/src/test/java/com/azure/storage/blob/LargeFileTest.java @@ -13,12 +13,12 @@ public class LargeFileTest { private static final Random RANDOM = new Random(); private static final String FILE_PATH = "C:\\Users\\jianghlu\\10g.dat"; - private static StorageClient storageClient; + private static BlobServiceClient storageClient; private static ContainerClient containerClient; //@BeforeClass public static void setup() { - storageClient = new StorageClientBuilder() + storageClient = new BlobServiceClientBuilder() .credential(new SharedKeyCredential(System.getenv("ACCOUNT_NAME"), System.getenv("ACCOUNT_KEY"))) .endpoint("https://" + System.getenv("ACCOUNT_NAME") + ".blob.core.windows.net") // .httpClient(HttpClient.createDefault().proxy(() -> new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888)))) diff --git a/storage/client/blob/src/test/java/com/azure/storage/blob/SASTest.groovy b/storage/client/blob/src/test/java/com/azure/storage/blob/SASTest.groovy index 2824ac1d3067..705453b54968 100644 --- a/storage/client/blob/src/test/java/com/azure/storage/blob/SASTest.groovy +++ b/storage/client/blob/src/test/java/com/azure/storage/blob/SASTest.groovy @@ -482,7 +482,7 @@ class SASTest extends APISpec { when: def sas = primaryServiceURL.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null) - def scBuilder = new StorageClientBuilder() + def scBuilder = new BlobServiceClientBuilder() scBuilder.endpoint(primaryServiceURL.getAccountUrl().toString()) .httpClient(getHttpClient()) .credential(SASTokenCredential.fromSASTokenString(sas)) @@ -509,7 +509,7 @@ class SASTest extends APISpec { when: def sas = primaryServiceURL.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null) - def scBuilder = new StorageClientBuilder() + def scBuilder = new BlobServiceClientBuilder() scBuilder.endpoint(primaryServiceURL.getAccountUrl().toString()) .httpClient(getHttpClient()) .credential(SASTokenCredential.fromSASTokenString(sas)) diff --git a/storage/client/blob/src/test/java/com/azure/storage/blob/Sample.java b/storage/client/blob/src/test/java/com/azure/storage/blob/Sample.java index f6d19d6b8416..d5955365880a 100644 --- a/storage/client/blob/src/test/java/com/azure/storage/blob/Sample.java +++ b/storage/client/blob/src/test/java/com/azure/storage/blob/Sample.java @@ -30,7 +30,7 @@ public class Sample { //@Test public void sample() throws IOException { // get service client - StorageClient serviceClient = new StorageClientBuilder().endpoint(ACCOUNT_ENDPOINT) + BlobServiceClient serviceClient = new BlobServiceClientBuilder().endpoint(ACCOUNT_ENDPOINT) .credential(new SharedKeyCredential(ACCOUNT_NAME, ACCOUNT_KEY)) .httpClient(HttpClient.createDefault()/*.proxy(() -> new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)))*/) .buildClient(); @@ -82,7 +82,7 @@ public void sample() throws IOException { //@Test public void asyncSample() throws IOException { // get service client - StorageAsyncClient serviceClient = new StorageClientBuilder().endpoint(ACCOUNT_ENDPOINT) + BlobServiceAsyncClient serviceClient = new BlobServiceClientBuilder().endpoint(ACCOUNT_ENDPOINT) .credential(new SharedKeyCredential(ACCOUNT_NAME, ACCOUNT_KEY)) .httpClient(HttpClient.createDefault()/*.proxy(() -> new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)))*/) .buildAsyncClient(); @@ -161,7 +161,7 @@ public void uploadDownloadFromFile() throws IOException { fstream.close(); // get service client - StorageClient serviceClient = new StorageClientBuilder().endpoint(ACCOUNT_ENDPOINT) + BlobServiceClient serviceClient = new BlobServiceClientBuilder().endpoint(ACCOUNT_ENDPOINT) .credential(new SharedKeyCredential(ACCOUNT_NAME, ACCOUNT_KEY)) .httpClient(HttpClient.createDefault()/*.proxy(() -> new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)))*/) .buildClient(); @@ -191,7 +191,7 @@ public void uploadDownloadFromFileAsync() throws IOException { fstream.close(); // get service client - StorageAsyncClient serviceClient = new StorageClientBuilder().endpoint(ACCOUNT_ENDPOINT) + BlobServiceAsyncClient serviceClient = new BlobServiceClientBuilder().endpoint(ACCOUNT_ENDPOINT) .credential(new SharedKeyCredential(ACCOUNT_NAME, ACCOUNT_KEY)) .httpClient(HttpClient.createDefault()/*.proxy(() -> new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)))*/) .buildAsyncClient(); diff --git a/storage/client/blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy b/storage/client/blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy index d6e8861b4739..830dd34c2203 100644 --- a/storage/client/blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy +++ b/storage/client/blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy @@ -234,7 +234,7 @@ class ServiceAPITest extends APISpec { def "Set props error"() { when: - new StorageClientBuilder() + new BlobServiceClientBuilder() .endpoint("https://error.blob.core.windows.net") .credential(primaryCreds) .buildClient() @@ -251,7 +251,7 @@ class ServiceAPITest extends APISpec { def "Get props error"() { when: - new StorageClientBuilder() + new BlobServiceClientBuilder() .endpoint("https://error.blob.core.windows.net") .credential(primaryCreds) .buildClient() @@ -306,7 +306,7 @@ class ServiceAPITest extends APISpec { def "Get stats"() { setup: String secondaryEndpoint = String.format("https://%s-secondary.blob.core.windows.net", primaryCreds.accountName()) - StorageClient serviceClient = new StorageClientBuilder().endpoint(secondaryEndpoint) + BlobServiceClient serviceClient = new BlobServiceClientBuilder().endpoint(secondaryEndpoint) .credential(primaryCreds).buildClient() Response response = serviceClient.getStatistics() @@ -321,7 +321,7 @@ class ServiceAPITest extends APISpec { def "Get stats min"() { setup: String secondaryEndpoint = String.format("https://%s-secondary.blob.core.windows.net", primaryCreds.accountName()) - StorageClient serviceClient = new StorageClientBuilder().endpoint(secondaryEndpoint) + BlobServiceClient serviceClient = new BlobServiceClientBuilder().endpoint(secondaryEndpoint) .credential(primaryCreds).buildClient() expect: serviceClient.getStatistics().statusCode() == 200 @@ -354,7 +354,7 @@ class ServiceAPITest extends APISpec { def "Get account info error"() { when: - StorageClient serviceURL = new StorageClientBuilder() + BlobServiceClient serviceURL = new BlobServiceClientBuilder() .endpoint(primaryServiceURL.getAccountUrl().toString()) .buildClient() serviceURL.getAccountInfo() @@ -368,7 +368,7 @@ class ServiceAPITest extends APISpec { def "Invalid account name"() { setup: URL badURL = new URL("http://fake.blobfake.core.windows.net") - StorageClient client = new StorageClientBuilder() + BlobServiceClient client = new BlobServiceClientBuilder() .endpoint(badURL.toString()) .credential(primaryCreds) .retryOptions(new RequestRetryOptions(null, 2, null, null, null, null)) diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java b/storage/client/queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java index 4bd8de4b8f13..659d128dc243 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java +++ b/storage/client/queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java @@ -108,6 +108,9 @@ public URL getQueueUrl() { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.create} * + *

For more information, see the + * Azure Docs.

+ * * @return A response that only contains headers and response status code * @throws StorageErrorException If a queue with the same name already exists in the queue service. */ @@ -124,6 +127,9 @@ public Mono create() { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.create#map} * + *

For more information, see the + * Azure Docs.

+ * * @param metadata Metadata to associate with the queue * @return A response that only contains headers and response status code * @throws StorageErrorException If a queue with the same name and different metadata already exists in the queue service. @@ -142,6 +148,9 @@ public Mono create(Map metadata) { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.delete} * + *

For more information, see the + * Azure Docs.

+ * * @return A response that only contains headers and response status code * @throws StorageErrorException If the queue doesn't exist */ @@ -159,6 +168,9 @@ public Mono delete() { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.getProperties} * + *

For more information, see the + * Azure Docs.

+ * * @return A response containing a {@link QueueProperties} value which contains the metadata and approximate * messages count of the queue. * @throws StorageErrorException If the queue doesn't exist @@ -183,6 +195,9 @@ public Mono> getProperties() { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.clearMetadata#map} * + *

For more information, see the + * Azure Docs.

+ * * @param metadata Metadata to set on the queue * @return A response that only contains headers and response status code * @throws StorageErrorException If the queue doesn't exist @@ -201,6 +216,9 @@ public Mono setMetadata(Map metadata) { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.getAccessPolicy} * + *

For more information, see the + * Azure Docs.

+ * * @return The stored access policies specified on the queue. * @throws StorageErrorException If the queue doesn't exist */ @@ -218,6 +236,9 @@ public Flux getAccessPolicy() { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.setAccessPolicy} * + *

For more information, see the + * Azure Docs.

+ * * @param permissions Access policies to set on the queue * @return A response that only contains headers and response status code * @throws StorageErrorException If the queue doesn't exist, a stored access policy doesn't have all fields filled out, @@ -237,6 +258,9 @@ public Mono setAccessPolicy(List permissions) { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.clearMessages} * + *

For more information, see the + * Azure Docs.

+ * * @return A response that only contains headers and response status code * @throws StorageErrorException If the queue doesn't exist */ @@ -254,6 +278,9 @@ public Mono clearMessages() { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.enqueueMessage#string} * + *

For more information, see the + * Azure Docs.

+ * * @param messageText Message text * @return A {@link EnqueuedMessage} value that contains the {@link EnqueuedMessage#messageId() messageId} and * {@link EnqueuedMessage#popReceipt() popReceipt} that are used to interact with the message and other metadata @@ -277,6 +304,9 @@ public Mono> enqueueMessage(String messageText) { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.enqueueMessageLiveTime#string-duration-duration} * + *

For more information, see the + * Azure Docs.

+ * * @param messageText Message text * @param visibilityTimeout Optional. The timeout period for how long the message is invisible in the queue in seconds. * If unset the value will default to 0 and the message will be instantly visible. The timeout must be between 0 @@ -307,6 +337,9 @@ public Mono> enqueueMessage(String messageText, Durati * * {@codesnippet com.azure.storage.queue.queueAsyncClient.dequeueMessages} * + *

For more information, see the + * Azure Docs.

+ * * @return The first {@link DequeuedMessage} in the queue, it contains * {@link DequeuedMessage#messageId() messageId} and {@link DequeuedMessage#popReceipt() popReceipt} used to interact * with the message, additionally it contains other metadata about the message. @@ -325,6 +358,9 @@ public Flux dequeueMessages() { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.dequeueMessages#integer} * + *

For more information, see the + * Azure Docs.

+ * * @param maxMessages Optional. Maximum number of messages to get, if there are less messages exist in the queue than requested * all the messages will be returned. If left empty only 1 message will be retrieved, the allowed range is 1 to 32 * messages. @@ -347,6 +383,9 @@ public Flux dequeueMessages(Integer maxMessages) { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.dequeueMessages#integer-duration} * + *

For more information, see the + * Azure Docs.

+ * * @param maxMessages Optional. Maximum number of messages to get, if there are less messages exist in the queue than requested * all the messages will be returned. If left empty only 1 message will be retrieved, the allowed range is 1 to 32 * messages. @@ -376,6 +415,9 @@ public Flux dequeueMessages(Integer maxMessages, Duration visib * * {@codesnippet com.azure.storage.queue.queueAsyncClient.peekMessages} * + *

For more information, see the + * Azure Docs.

+ * * @return A {@link PeekedMessage} that contains metadata about the message. */ public Flux peekMessages() { @@ -394,6 +436,9 @@ public Flux peekMessages() { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.peekMessages#integer} * + *

For more information, see the + * Azure Docs.

+ * * @param maxMessages Optional. Maximum number of messages to peek, if there are less messages exist in the queue than requested * all the messages will be peeked. If left empty only 1 message will be peeked, the allowed range is 1 to 32 * messages. @@ -415,6 +460,9 @@ public Flux peekMessages(Integer maxMessages) { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.updateMessage} * + *

For more information, see the + * Azure Docs.

+ * * @param messageText Updated value for the message * @param messageId Id of the message to update * @param popReceipt Unique identifier that must match for the message to be updated @@ -440,6 +488,9 @@ public Mono> updateMessage(String messageText, String m * * {@codesnippet com.azure.storage.queue.queueAsyncClient.deleteMessage} * + *

For more information, see the + * Azure Docs.

+ * * @param messageId Id of the message to deleted * @param popReceipt Unique identifier that must match for the message to be deleted * @return A response that only contains headers and response status code diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/QueueClient.java b/storage/client/queue/src/main/java/com/azure/storage/queue/QueueClient.java index 763c58560871..3e55da311b15 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/QueueClient.java +++ b/storage/client/queue/src/main/java/com/azure/storage/queue/QueueClient.java @@ -63,6 +63,9 @@ public URL getQueueUrl() { * *{@codesnippet com.azure.storage.queue.queueClient.create} * + *

For more information, see the + * Azure Docs.

+ * * @return A response that only contains headers and response status code * @throws StorageErrorException If a queue with the same name already exists in the queue service. */ @@ -79,6 +82,9 @@ public VoidResponse create() { * * {@codesnippet com.azure.storage.queue.queueClient.create#map} * + *

For more information, see the + * Azure Docs.

+ * * @param metadata Metadata to associate with the queue * @return A response that only contains headers and response status code * @throws StorageErrorException If a queue with the same name and different metadata already exists in the queue service. @@ -96,6 +102,9 @@ public VoidResponse create(Map metadata) { * * {@codesnippet com.azure.storage.queue.queueClient.delete} * + *

For more information, see the + * Azure Docs.

+ * * @return A response that only contains headers and response status code * @throws StorageErrorException If the queue doesn't exist */ @@ -112,6 +121,9 @@ public VoidResponse delete() { * * {@codesnippet com.azure.storage.queue.queueClient.getProperties} * + *

For more information, see the + * Azure Docs.

+ * * @return A response containing a {@link QueueProperties} value which contains the metadata and approximate * messages count of the queue. * @throws StorageErrorException If the queue doesn't exist @@ -135,6 +147,9 @@ public Response getProperties() { * * {@codesnippet com.azure.storage.queue.queueClient.clearMetadata#map} * + *

For more information, see the + * Azure Docs.

+ * * @param metadata Metadata to set on the queue * @return A response that only contains headers and response status code * @throws StorageErrorException If the queue doesn't exist @@ -152,6 +167,9 @@ public VoidResponse setMetadata(Map metadata) { * * {@codesnippet com.azure.storage.queue.queueClient.getAccessPolicy} * + *

For more information, see the + * Azure Docs.

+ * * @return The stored access policies specified on the queue. * @throws StorageErrorException If the queue doesn't exist */ @@ -168,6 +186,9 @@ public Iterable getAccessPolicy() { * * {@codesnippet com.azure.storage.queue.queueClient.setAccessPolicy} * + *

For more information, see the + * Azure Docs.

+ * * @param permissions Access policies to set on the queue * @return A response that only contains headers and response status code * @throws StorageErrorException If the queue doesn't exist, a stored access policy doesn't have all fields filled out, @@ -186,6 +207,9 @@ public VoidResponse setAccessPolicy(List permissions) { * * {@codesnippet com.azure.storage.queue.queueClient.clearMessages} * + *

For more information, see the + * Azure Docs.

+ * * @return A response that only contains headers and response status code * @throws StorageErrorException If the queue doesn't exist */ @@ -202,6 +226,9 @@ public VoidResponse clearMessages() { * * {@codesnippet com.azure.storage.queue.queueClient.enqueueMessage#string} * + *

For more information, see the + * Azure Docs.

+ * * @param messageText Message text * @return A {@link EnqueuedMessage} value that contains the {@link EnqueuedMessage#messageId() messageId} and * {@link EnqueuedMessage#popReceipt() popReceipt} that are used to interact with the message and other metadata @@ -225,6 +252,9 @@ public Response enqueueMessage(String messageText) { * * {@codesnippet com.azure.storage.queue.queueClient.enqueueMessageLiveTime#string-duration-duration} * + *

For more information, see the + * Azure Docs.

+ * * @param messageText Message text * @param visibilityTimeout Optional. The timeout period for how long the message is invisible in the queue in seconds. * If unset the value will default to 0 and the message will be instantly visible. The timeout must be between 0 @@ -250,6 +280,9 @@ public Response enqueueMessage(String messageText, Duration vis * * {@codesnippet com.azure.storage.queue.queueClient.dequeueMessages} * + *

For more information, see the + * Azure Docs.

+ * * @return The first {@link DequeuedMessage} in the queue, it contains * {@link DequeuedMessage#messageId() messageId} and {@link DequeuedMessage#popReceipt() popReceipt} used to interact * with the message, additionally it contains other metadata about the message. @@ -268,6 +301,9 @@ public Iterable dequeueMessages() { * * {@codesnippet com.azure.storage.queue.queueClient.dequeueMessages#integer} * + *

For more information, see the + * Azure Docs.

+ * * @param maxMessages Optional. Maximum number of messages to get, if there are less messages exist in the queue than requested * all the messages will be returned. If left empty only 1 message will be retrieved, the allowed range is 1 to 32 * messages. @@ -290,6 +326,9 @@ public Iterable dequeueMessages(Integer maxMessages) { * * {@codesnippet com.azure.storage.queue.queueClient.dequeueMessages#integer-duration} * + *

For more information, see the + * Azure Docs.

+ * * @param maxMessages Optional. Maximum number of messages to get, if there are less messages exist in the queue than requested * all the messages will be returned. If left empty only 1 message will be retrieved, the allowed range is 1 to 32 * messages. @@ -317,6 +356,9 @@ public Iterable dequeueMessages(Integer maxMessages, Duration v * * {@codesnippet com.azure.storage.queue.queueClient.peekMessages} * + *

For more information, see the + * Azure Docs.

+ * * @return A {@link PeekedMessage} that contains metadata about the message. */ public Iterable peekMessages() { @@ -335,6 +377,9 @@ public Iterable peekMessages() { * * {@codesnippet com.azure.storage.queue.queueClient.peekMessages#integer} * + *

For more information, see the + * Azure Docs.

+ * * @param maxMessages Optional. Maximum number of messages to peek, if there are less messages exist in the queue than requested * all the messages will be peeked. If left empty only 1 message will be peeked, the allowed range is 1 to 32 * messages. @@ -355,6 +400,9 @@ public Iterable peekMessages(Integer maxMessages) { * * {@codesnippet com.azure.storage.queue.queueClient.updateMessage} * + *

For more information, see the + * Azure Docs.

+ * * @param messageText Updated value for the message * @param messageId Id of the message to update * @param popReceipt Unique identifier that must match for the message to be updated @@ -378,6 +426,9 @@ public Response updateMessage(String messageText, String message * * {@codesnippet com.azure.storage.queue.queueClient.deleteMessage} * + *

For more information, see the + * Azure Docs.

+ * * @param messageId Id of the message to deleted * @param popReceipt Unique identifier that must match for the message to be deleted * @return A response that only contains headers and response status code diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java b/storage/client/queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java index 6e6b099653bc..74a6e978a4f0 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java +++ b/storage/client/queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java @@ -21,13 +21,14 @@ import com.azure.storage.queue.models.StorageErrorException; import com.azure.storage.queue.models.StorageServiceProperties; import com.azure.storage.queue.models.StorageServiceStats; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.List; import java.util.Map; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; /** * This class provides a client that contains all the operations for interacting with a queue account in Azure Storage. @@ -153,6 +154,9 @@ public Mono deleteQueue(String queueName) { * * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.listQueues} * + *

For more information, see the + * Azure Docs.

+ * * @return {@link QueueItem Queues} in the storage account */ public Flux listQueues() { @@ -171,6 +175,9 @@ public Flux listQueues() { * * {@codesnippet com.azure.storage.queue.queueServiceClient.listQueues#queueSergmentOptions} * + *

For more information, see the + * Azure Docs.

+ * * @param options Options for listing queues * @return {@link QueueItem Queues} in the storage account that satisfy the filter requirements */ @@ -240,6 +247,9 @@ private Flux extractAndFetchQueues(ServicesListQueuesSegmentResponse * * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.getProperties} * + *

For more information, see the + * Azure Docs.

+ * * @return Storage account Queue service properties */ public Mono> getProperties() { @@ -264,6 +274,9 @@ public Mono> getProperties() { * * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.setPropertiesEnableMetrics#storageServiceProperties} * + *

For more information, see the + * Azure Docs.

+ * * @param properties Storage account Queue service properties * @return A response that only contains headers and response status code * @throws StorageErrorException When one of the following is true @@ -292,6 +305,9 @@ public Mono setProperties(StorageServiceProperties properties) { * * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.getStatistics} * + *

For more information, see the + * Azure Docs.

+ * * @return The geo replication information about the Queue service */ public Mono> getStatistics() { diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java b/storage/client/queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java index a002e5b12f87..78ef5b204281 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java +++ b/storage/client/queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java @@ -127,6 +127,9 @@ public VoidResponse deleteQueue(String queueName) { * * {@codesnippet com.azure.storage.queue.queueServiceClient.listQueues} * + *

For more information, see the + * Azure Docs.

+ * * @return {@link QueueItem Queues} in the storage account */ public Iterable listQueues() { @@ -145,6 +148,9 @@ public Iterable listQueues() { * * {@codesnippet com.azure.storage.queue.queueServiceClient.listQueues#queueSergmentOptions} * + *

For more information, see the + * Azure Docs.

+ * * @param options Options for listing queues * @return {@link QueueItem Queues} in the storage account that satisfy the filter requirements */ @@ -176,6 +182,9 @@ Iterable listQueues(String marker, QueuesSegmentOptions options) { * * {@codesnippet com.azure.storage.queue.queueServiceClient.getProperties} * + *

For more information, see the + * Azure Docs.

+ * * @return Storage account Queue service properties */ public Response getProperties() { @@ -199,6 +208,9 @@ public Response getProperties() { * * {@codesnippet com.azure.storage.queue.queueServiceClient.setPropertiesEnableMetrics#storageServiceProperties} * + *

For more information, see the + * Azure Docs.

+ * * @param properties Storage account Queue service properties * @return A response that only contains headers and response status code * @throws StorageErrorException When one of the following is true @@ -226,6 +238,9 @@ public VoidResponse setProperties(StorageServiceProperties properties) { * * {@codesnippet com.azure.storage.queue.queueServiceClient.getStatistics} * + *

For more information, see the + * Azure Docs.

+ * * @return The geo replication information about the Queue service */ public Response getStatistics() {