diff --git a/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/implementation/VaultImpl.java b/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/implementation/VaultImpl.java index d2d028be841de..2620419164d24 100644 --- a/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/implementation/VaultImpl.java +++ b/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/implementation/VaultImpl.java @@ -20,6 +20,7 @@ import com.azure.resourcemanager.keyvault.models.NetworkRuleSet; import com.azure.resourcemanager.keyvault.models.Secrets; import com.azure.resourcemanager.keyvault.models.Sku; +import com.azure.resourcemanager.keyvault.models.SkuFamily; import com.azure.resourcemanager.keyvault.models.SkuName; import com.azure.resourcemanager.keyvault.models.Vault; import com.azure.resourcemanager.keyvault.models.VaultCreateOrUpdateParameters; @@ -283,7 +284,7 @@ public VaultImpl withSku(SkuName skuName) { if (inner().properties() == null) { inner().withProperties(new VaultProperties()); } - inner().properties().withSku(new Sku().withName(skuName)); + inner().properties().withSku(new Sku().withName(skuName).withFamily(SkuFamily.A)); return this; } diff --git a/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/implementation/VaultsImpl.java b/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/implementation/VaultsImpl.java index 8c17e1a868b49..c3a5fc3ea78f1 100644 --- a/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/implementation/VaultsImpl.java +++ b/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/implementation/VaultsImpl.java @@ -14,6 +14,7 @@ import com.azure.resourcemanager.keyvault.models.CreateMode; import com.azure.resourcemanager.keyvault.models.DeletedVault; import com.azure.resourcemanager.keyvault.models.Sku; +import com.azure.resourcemanager.keyvault.models.SkuFamily; import com.azure.resourcemanager.keyvault.models.SkuName; import com.azure.resourcemanager.keyvault.models.Vault; import com.azure.resourcemanager.keyvault.models.VaultCreateOrUpdateParameters; @@ -145,7 +146,7 @@ public Mono recoverSoftDeletedVaultAsync( .withProperties( new VaultProperties() .withCreateMode(CreateMode.RECOVER) - .withSku(new Sku().withName(SkuName.STANDARD)) + .withSku(new Sku().withName(SkuName.STANDARD).withFamily(SkuFamily.A)) .withTenantId(UUID.fromString(tenantId))); return inner() .createOrUpdateAsync(resourceGroupName, vaultName, parameters) diff --git a/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/models/Sku.java b/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/models/Sku.java index ee6cb828e8e69..868277d144266 100644 --- a/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/models/Sku.java +++ b/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/models/Sku.java @@ -18,7 +18,7 @@ public final class Sku { * SKU family name */ @JsonProperty(value = "family", required = true) - private String family; + private SkuFamily family; /* * SKU name to specify whether the key vault is a standard vault or a @@ -27,17 +27,12 @@ public final class Sku { @JsonProperty(value = "name", required = true) private SkuName name; - /** Creates an instance of Sku class. */ - public Sku() { - family = "A"; - } - /** * Get the family property: SKU family name. * * @return the family value. */ - public String family() { + public SkuFamily family() { return this.family; } @@ -47,7 +42,7 @@ public String family() { * @param family the family value to set. * @return the Sku object itself. */ - public Sku withFamily(String family) { + public Sku withFamily(SkuFamily family) { this.family = family; return this; } @@ -78,6 +73,10 @@ public Sku withName(SkuName name) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (family() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property family in model Sku")); + } if (name() == null) { throw logger .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Sku")); diff --git a/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/models/SkuFamily.java b/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/models/SkuFamily.java new file mode 100644 index 0000000000000..13a0401af6b31 --- /dev/null +++ b/sdk/keyvault/mgmt/src/main/java/com/azure/resourcemanager/keyvault/models/SkuFamily.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SkuFamily. */ +public final class SkuFamily extends ExpandableStringEnum { + /** Static value A for SkuFamily. */ + public static final SkuFamily A = fromString("A"); + + /** + * Creates or finds a SkuFamily from its string representation. + * + * @param name a name to look for. + * @return the corresponding SkuFamily. + */ + @JsonCreator + public static SkuFamily fromString(String name) { + return fromString(name, SkuFamily.class); + } + + /** @return known SkuFamily values. */ + public static Collection values() { + return values(SkuFamily.class); + } +} diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/fluent/inner/UsageInner.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/fluent/inner/UsageInner.java index e7fbc65e2e65b..76248a9aec8a3 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/fluent/inner/UsageInner.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/fluent/inner/UsageInner.java @@ -7,6 +7,7 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.network.models.UsageName; +import com.azure.resourcemanager.network.models.UsageUnit; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @@ -25,7 +26,7 @@ public final class UsageInner { * An enum describing the unit of measurement. */ @JsonProperty(value = "unit", required = true) - private String unit; + private UsageUnit unit; /* * The current value of the usage. @@ -45,11 +46,6 @@ public final class UsageInner { @JsonProperty(value = "name", required = true) private UsageName name; - /** Creates an instance of UsageInner class. */ - public UsageInner() { - unit = "Count"; - } - /** * Get the id property: Resource identifier. * @@ -64,7 +60,7 @@ public String id() { * * @return the unit value. */ - public String unit() { + public UsageUnit unit() { return this.unit; } @@ -74,7 +70,7 @@ public String unit() { * @param unit the unit value to set. * @return the UsageInner object itself. */ - public UsageInner withUnit(String unit) { + public UsageInner withUnit(UsageUnit unit) { this.unit = unit; return this; } @@ -145,6 +141,11 @@ public UsageInner withName(UsageName name) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (unit() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property unit in model UsageInner")); + } if (name() == null) { throw logger .logExceptionAsError( diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/implementation/NetworkUsageImpl.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/implementation/NetworkUsageImpl.java index 8f3453b0cb70a..ee78b0daa521d 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/implementation/NetworkUsageImpl.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/implementation/NetworkUsageImpl.java @@ -3,9 +3,9 @@ package com.azure.resourcemanager.network.implementation; import com.azure.resourcemanager.network.models.NetworkUsage; -import com.azure.resourcemanager.network.models.NetworkUsageUnit; import com.azure.resourcemanager.network.models.UsageName; import com.azure.resourcemanager.network.fluent.inner.UsageInner; +import com.azure.resourcemanager.network.models.UsageUnit; import com.azure.resourcemanager.resources.fluentcore.model.implementation.WrapperImpl; import com.azure.resourcemanager.resources.fluentcore.utils.Utils; @@ -16,8 +16,8 @@ class NetworkUsageImpl extends WrapperImpl implements NetworkUsage { } @Override - public NetworkUsageUnit unit() { - return NetworkUsageUnit.fromString(inner().unit()); + public UsageUnit unit() { + return inner().unit(); } @Override diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/AzureFirewallSkuTier.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/AzureFirewallSkuTier.java index acdf014920078..9016a806853e0 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/AzureFirewallSkuTier.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/AzureFirewallSkuTier.java @@ -4,41 +4,28 @@ package com.azure.resourcemanager.network.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for AzureFirewallSkuTier. */ -public enum AzureFirewallSkuTier { - /** Enum value Standard. */ - STANDARD("Standard"); - - /** The actual serialized value for a AzureFirewallSkuTier instance. */ - private final String value; - - AzureFirewallSkuTier(String value) { - this.value = value; - } +public final class AzureFirewallSkuTier extends ExpandableStringEnum { + /** Static value Standard for AzureFirewallSkuTier. */ + public static final AzureFirewallSkuTier STANDARD = fromString("Standard"); /** - * Parses a serialized value to a AzureFirewallSkuTier instance. + * Creates or finds a AzureFirewallSkuTier from its string representation. * - * @param value the serialized value to parse. - * @return the parsed AzureFirewallSkuTier object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding AzureFirewallSkuTier. */ @JsonCreator - public static AzureFirewallSkuTier fromString(String value) { - AzureFirewallSkuTier[] items = AzureFirewallSkuTier.values(); - for (AzureFirewallSkuTier item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static AzureFirewallSkuTier fromString(String name) { + return fromString(name, AzureFirewallSkuTier.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** @return known AzureFirewallSkuTier values. */ + public static Collection values() { + return values(AzureFirewallSkuTier.class); } } diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/ConnectionMonitorEndpointFilterItemType.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/ConnectionMonitorEndpointFilterItemType.java index a9c94ccf95442..e9c06f94fe095 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/ConnectionMonitorEndpointFilterItemType.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/ConnectionMonitorEndpointFilterItemType.java @@ -4,41 +4,29 @@ package com.azure.resourcemanager.network.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for ConnectionMonitorEndpointFilterItemType. */ -public enum ConnectionMonitorEndpointFilterItemType { - /** Enum value AgentAddress. */ - AGENT_ADDRESS("AgentAddress"); - - /** The actual serialized value for a ConnectionMonitorEndpointFilterItemType instance. */ - private final String value; - - ConnectionMonitorEndpointFilterItemType(String value) { - this.value = value; - } +public final class ConnectionMonitorEndpointFilterItemType + extends ExpandableStringEnum { + /** Static value AgentAddress for ConnectionMonitorEndpointFilterItemType. */ + public static final ConnectionMonitorEndpointFilterItemType AGENT_ADDRESS = fromString("AgentAddress"); /** - * Parses a serialized value to a ConnectionMonitorEndpointFilterItemType instance. + * Creates or finds a ConnectionMonitorEndpointFilterItemType from its string representation. * - * @param value the serialized value to parse. - * @return the parsed ConnectionMonitorEndpointFilterItemType object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding ConnectionMonitorEndpointFilterItemType. */ @JsonCreator - public static ConnectionMonitorEndpointFilterItemType fromString(String value) { - ConnectionMonitorEndpointFilterItemType[] items = ConnectionMonitorEndpointFilterItemType.values(); - for (ConnectionMonitorEndpointFilterItemType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static ConnectionMonitorEndpointFilterItemType fromString(String name) { + return fromString(name, ConnectionMonitorEndpointFilterItemType.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** @return known ConnectionMonitorEndpointFilterItemType values. */ + public static Collection values() { + return values(ConnectionMonitorEndpointFilterItemType.class); } } diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/ConnectionMonitorEndpointFilterType.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/ConnectionMonitorEndpointFilterType.java index 2e9617748f80d..2dab2c699f325 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/ConnectionMonitorEndpointFilterType.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/ConnectionMonitorEndpointFilterType.java @@ -4,41 +4,29 @@ package com.azure.resourcemanager.network.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for ConnectionMonitorEndpointFilterType. */ -public enum ConnectionMonitorEndpointFilterType { - /** Enum value Include. */ - INCLUDE("Include"); - - /** The actual serialized value for a ConnectionMonitorEndpointFilterType instance. */ - private final String value; - - ConnectionMonitorEndpointFilterType(String value) { - this.value = value; - } +public final class ConnectionMonitorEndpointFilterType + extends ExpandableStringEnum { + /** Static value Include for ConnectionMonitorEndpointFilterType. */ + public static final ConnectionMonitorEndpointFilterType INCLUDE = fromString("Include"); /** - * Parses a serialized value to a ConnectionMonitorEndpointFilterType instance. + * Creates or finds a ConnectionMonitorEndpointFilterType from its string representation. * - * @param value the serialized value to parse. - * @return the parsed ConnectionMonitorEndpointFilterType object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding ConnectionMonitorEndpointFilterType. */ @JsonCreator - public static ConnectionMonitorEndpointFilterType fromString(String value) { - ConnectionMonitorEndpointFilterType[] items = ConnectionMonitorEndpointFilterType.values(); - for (ConnectionMonitorEndpointFilterType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static ConnectionMonitorEndpointFilterType fromString(String name) { + return fromString(name, ConnectionMonitorEndpointFilterType.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** @return known ConnectionMonitorEndpointFilterType values. */ + public static Collection values() { + return values(ConnectionMonitorEndpointFilterType.class); } } diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/FirewallPolicyNatRuleActionType.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/FirewallPolicyNatRuleActionType.java index 8018b04cb3202..f1b91badf6f81 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/FirewallPolicyNatRuleActionType.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/FirewallPolicyNatRuleActionType.java @@ -4,41 +4,28 @@ package com.azure.resourcemanager.network.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for FirewallPolicyNatRuleActionType. */ -public enum FirewallPolicyNatRuleActionType { - /** Enum value DNAT. */ - DNAT("DNAT"); - - /** The actual serialized value for a FirewallPolicyNatRuleActionType instance. */ - private final String value; - - FirewallPolicyNatRuleActionType(String value) { - this.value = value; - } +public final class FirewallPolicyNatRuleActionType extends ExpandableStringEnum { + /** Static value DNAT for FirewallPolicyNatRuleActionType. */ + public static final FirewallPolicyNatRuleActionType DNAT = fromString("DNAT"); /** - * Parses a serialized value to a FirewallPolicyNatRuleActionType instance. + * Creates or finds a FirewallPolicyNatRuleActionType from its string representation. * - * @param value the serialized value to parse. - * @return the parsed FirewallPolicyNatRuleActionType object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding FirewallPolicyNatRuleActionType. */ @JsonCreator - public static FirewallPolicyNatRuleActionType fromString(String value) { - FirewallPolicyNatRuleActionType[] items = FirewallPolicyNatRuleActionType.values(); - for (FirewallPolicyNatRuleActionType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static FirewallPolicyNatRuleActionType fromString(String name) { + return fromString(name, FirewallPolicyNatRuleActionType.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** @return known FirewallPolicyNatRuleActionType values. */ + public static Collection values() { + return values(FirewallPolicyNatRuleActionType.class); } } diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/FlowLogFormatType.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/FlowLogFormatType.java index 5778e94282a44..fddce7ca6e0df 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/FlowLogFormatType.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/FlowLogFormatType.java @@ -4,41 +4,28 @@ package com.azure.resourcemanager.network.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for FlowLogFormatType. */ -public enum FlowLogFormatType { - /** Enum value JSON. */ - JSON("JSON"); - - /** The actual serialized value for a FlowLogFormatType instance. */ - private final String value; - - FlowLogFormatType(String value) { - this.value = value; - } +public final class FlowLogFormatType extends ExpandableStringEnum { + /** Static value JSON for FlowLogFormatType. */ + public static final FlowLogFormatType JSON = fromString("JSON"); /** - * Parses a serialized value to a FlowLogFormatType instance. + * Creates or finds a FlowLogFormatType from its string representation. * - * @param value the serialized value to parse. - * @return the parsed FlowLogFormatType object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding FlowLogFormatType. */ @JsonCreator - public static FlowLogFormatType fromString(String value) { - FlowLogFormatType[] items = FlowLogFormatType.values(); - for (FlowLogFormatType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static FlowLogFormatType fromString(String name) { + return fromString(name, FlowLogFormatType.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** @return known FlowLogFormatType values. */ + public static Collection values() { + return values(FlowLogFormatType.class); } } diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/HttpMethod.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/HttpMethod.java index 6a58b52461511..c4b10a52e74da 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/HttpMethod.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/HttpMethod.java @@ -4,41 +4,28 @@ package com.azure.resourcemanager.network.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for HttpMethod. */ -public enum HttpMethod { - /** Enum value Get. */ - GET("Get"); - - /** The actual serialized value for a HttpMethod instance. */ - private final String value; - - HttpMethod(String value) { - this.value = value; - } +public final class HttpMethod extends ExpandableStringEnum { + /** Static value Get for HttpMethod. */ + public static final HttpMethod GET = fromString("Get"); /** - * Parses a serialized value to a HttpMethod instance. + * Creates or finds a HttpMethod from its string representation. * - * @param value the serialized value to parse. - * @return the parsed HttpMethod object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding HttpMethod. */ @JsonCreator - public static HttpMethod fromString(String value) { - HttpMethod[] items = HttpMethod.values(); - for (HttpMethod item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static HttpMethod fromString(String name) { + return fromString(name, HttpMethod.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** @return known HttpMethod values. */ + public static Collection values() { + return values(HttpMethod.class); } } diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/ManagedRuleEnabledState.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/ManagedRuleEnabledState.java index 2ced6dfc11258..f2ff5af16ad28 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/ManagedRuleEnabledState.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/ManagedRuleEnabledState.java @@ -4,41 +4,28 @@ package com.azure.resourcemanager.network.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for ManagedRuleEnabledState. */ -public enum ManagedRuleEnabledState { - /** Enum value Disabled. */ - DISABLED("Disabled"); - - /** The actual serialized value for a ManagedRuleEnabledState instance. */ - private final String value; - - ManagedRuleEnabledState(String value) { - this.value = value; - } +public final class ManagedRuleEnabledState extends ExpandableStringEnum { + /** Static value Disabled for ManagedRuleEnabledState. */ + public static final ManagedRuleEnabledState DISABLED = fromString("Disabled"); /** - * Parses a serialized value to a ManagedRuleEnabledState instance. + * Creates or finds a ManagedRuleEnabledState from its string representation. * - * @param value the serialized value to parse. - * @return the parsed ManagedRuleEnabledState object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding ManagedRuleEnabledState. */ @JsonCreator - public static ManagedRuleEnabledState fromString(String value) { - ManagedRuleEnabledState[] items = ManagedRuleEnabledState.values(); - for (ManagedRuleEnabledState item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static ManagedRuleEnabledState fromString(String name) { + return fromString(name, ManagedRuleEnabledState.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** @return known ManagedRuleEnabledState values. */ + public static Collection values() { + return values(ManagedRuleEnabledState.class); } } diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/NatGatewaySkuName.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/NatGatewaySkuName.java index 787d6a4fbe5b9..e9ab2796310ee 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/NatGatewaySkuName.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/NatGatewaySkuName.java @@ -4,41 +4,28 @@ package com.azure.resourcemanager.network.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for NatGatewaySkuName. */ -public enum NatGatewaySkuName { - /** Enum value Standard. */ - STANDARD("Standard"); - - /** The actual serialized value for a NatGatewaySkuName instance. */ - private final String value; - - NatGatewaySkuName(String value) { - this.value = value; - } +public final class NatGatewaySkuName extends ExpandableStringEnum { + /** Static value Standard for NatGatewaySkuName. */ + public static final NatGatewaySkuName STANDARD = fromString("Standard"); /** - * Parses a serialized value to a NatGatewaySkuName instance. + * Creates or finds a NatGatewaySkuName from its string representation. * - * @param value the serialized value to parse. - * @return the parsed NatGatewaySkuName object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding NatGatewaySkuName. */ @JsonCreator - public static NatGatewaySkuName fromString(String value) { - NatGatewaySkuName[] items = NatGatewaySkuName.values(); - for (NatGatewaySkuName item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static NatGatewaySkuName fromString(String name) { + return fromString(name, NatGatewaySkuName.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** @return known NatGatewaySkuName values. */ + public static Collection values() { + return values(NatGatewaySkuName.class); } } diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/NetworkUsage.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/NetworkUsage.java index d2ea5f31913bd..20d6e6767ad97 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/NetworkUsage.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/NetworkUsage.java @@ -10,7 +10,7 @@ @Fluent public interface NetworkUsage extends HasInner { /** @return the unit of measurement. */ - NetworkUsageUnit unit(); + UsageUnit unit(); /** @return the current count of the allocated resources in the subscription */ long currentValue(); diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/NetworkUsageUnit.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/NetworkUsageUnit.java deleted file mode 100644 index 6b05dd248ea97..0000000000000 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/NetworkUsageUnit.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.resourcemanager.network.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** Network usage units. */ -public class NetworkUsageUnit extends ExpandableStringEnum { - /** Static value Count for NetworkUsageUnit. */ - public static final NetworkUsageUnit COUNT = fromString("Count"); - - /** Static value Bytes for NetworkUsageUnit. */ - public static final NetworkUsageUnit BYTES = fromString("Bytes"); - - /** Static value Seconds for NetworkUsageUnit. */ - public static final NetworkUsageUnit SECONDS = fromString("Seconds"); - - /** Static value Percent for NetworkUsageUnit. */ - public static final NetworkUsageUnit PERCENT = fromString("Percent"); - - /** Static value CountsPerSecond for NetworkUsageUnit. */ - public static final NetworkUsageUnit COUNTS_PER_SECOND = fromString("CountsPerSecond"); - - /** Static value BytesPerSecond for ComputeUsageUnit. */ - public static final NetworkUsageUnit BYTES_PER_SECOND = fromString("BytesPerSecond"); - - /** - * Finds or creates a network usage unit based on the specified name. - * - * @param name a name - * @return an instance of NetworkUsageUnit - */ - public static NetworkUsageUnit fromString(String name) { - return fromString(name, NetworkUsageUnit.class); - } - - /** @return known network usage units */ - public static Collection values() { - return values(NetworkUsageUnit.class); - } -} diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/OutputType.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/OutputType.java index 0b807f0e29a66..4c7c992b911c1 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/OutputType.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/OutputType.java @@ -4,41 +4,28 @@ package com.azure.resourcemanager.network.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for OutputType. */ -public enum OutputType { - /** Enum value Workspace. */ - WORKSPACE("Workspace"); - - /** The actual serialized value for a OutputType instance. */ - private final String value; - - OutputType(String value) { - this.value = value; - } +public final class OutputType extends ExpandableStringEnum { + /** Static value Workspace for OutputType. */ + public static final OutputType WORKSPACE = fromString("Workspace"); /** - * Parses a serialized value to a OutputType instance. + * Creates or finds a OutputType from its string representation. * - * @param value the serialized value to parse. - * @return the parsed OutputType object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding OutputType. */ @JsonCreator - public static OutputType fromString(String value) { - OutputType[] items = OutputType.values(); - for (OutputType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static OutputType fromString(String name) { + return fromString(name, OutputType.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** @return known OutputType values. */ + public static Collection values() { + return values(OutputType.class); } } diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/PublicIpPrefixSkuName.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/PublicIpPrefixSkuName.java index 3195f9541be93..3607cb9e7d74f 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/PublicIpPrefixSkuName.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/PublicIpPrefixSkuName.java @@ -4,41 +4,28 @@ package com.azure.resourcemanager.network.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for PublicIpPrefixSkuName. */ -public enum PublicIpPrefixSkuName { - /** Enum value Standard. */ - STANDARD("Standard"); - - /** The actual serialized value for a PublicIpPrefixSkuName instance. */ - private final String value; - - PublicIpPrefixSkuName(String value) { - this.value = value; - } +public final class PublicIpPrefixSkuName extends ExpandableStringEnum { + /** Static value Standard for PublicIpPrefixSkuName. */ + public static final PublicIpPrefixSkuName STANDARD = fromString("Standard"); /** - * Parses a serialized value to a PublicIpPrefixSkuName instance. + * Creates or finds a PublicIpPrefixSkuName from its string representation. * - * @param value the serialized value to parse. - * @return the parsed PublicIpPrefixSkuName object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding PublicIpPrefixSkuName. */ @JsonCreator - public static PublicIpPrefixSkuName fromString(String value) { - PublicIpPrefixSkuName[] items = PublicIpPrefixSkuName.values(); - for (PublicIpPrefixSkuName item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static PublicIpPrefixSkuName fromString(String name) { + return fromString(name, PublicIpPrefixSkuName.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** @return known PublicIpPrefixSkuName values. */ + public static Collection values() { + return values(PublicIpPrefixSkuName.class); } } diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/RouteFilterRuleType.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/RouteFilterRuleType.java index 49de03d20274e..6b9a5c0f7e96f 100644 --- a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/RouteFilterRuleType.java +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/RouteFilterRuleType.java @@ -4,41 +4,28 @@ package com.azure.resourcemanager.network.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for RouteFilterRuleType. */ -public enum RouteFilterRuleType { - /** Enum value Community. */ - COMMUNITY("Community"); - - /** The actual serialized value for a RouteFilterRuleType instance. */ - private final String value; - - RouteFilterRuleType(String value) { - this.value = value; - } +public final class RouteFilterRuleType extends ExpandableStringEnum { + /** Static value Community for RouteFilterRuleType. */ + public static final RouteFilterRuleType COMMUNITY = fromString("Community"); /** - * Parses a serialized value to a RouteFilterRuleType instance. + * Creates or finds a RouteFilterRuleType from its string representation. * - * @param value the serialized value to parse. - * @return the parsed RouteFilterRuleType object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding RouteFilterRuleType. */ @JsonCreator - public static RouteFilterRuleType fromString(String value) { - RouteFilterRuleType[] items = RouteFilterRuleType.values(); - for (RouteFilterRuleType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static RouteFilterRuleType fromString(String name) { + return fromString(name, RouteFilterRuleType.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** @return known RouteFilterRuleType values. */ + public static Collection values() { + return values(RouteFilterRuleType.class); } } diff --git a/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/UsageUnit.java b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/UsageUnit.java new file mode 100644 index 0000000000000..66d59e6a65d50 --- /dev/null +++ b/sdk/network/mgmt/src/main/java/com/azure/resourcemanager/network/models/UsageUnit.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for UsageUnit. */ +public final class UsageUnit extends ExpandableStringEnum { + /** Static value Count for UsageUnit. */ + public static final UsageUnit COUNT = fromString("Count"); + + /** + * Creates or finds a UsageUnit from its string representation. + * + * @param name a name to look for. + * @return the corresponding UsageUnit. + */ + @JsonCreator + public static UsageUnit fromString(String name) { + return fromString(name, UsageUnit.class); + } + + /** @return known UsageUnit values. */ + public static Collection values() { + return values(UsageUnit.class); + } +} diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/fluent/BlobContainersClient.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/fluent/BlobContainersClient.java index 0093ed602ff87..8f99917e2bc6d 100644 --- a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/fluent/BlobContainersClient.java +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/fluent/BlobContainersClient.java @@ -44,7 +44,7 @@ import com.azure.resourcemanager.storage.models.BlobContainersGetImmutabilityPolicyResponse; import com.azure.resourcemanager.storage.models.BlobContainersLockImmutabilityPolicyResponse; import com.azure.resourcemanager.storage.models.LeaseContainerRequest; -import com.azure.resourcemanager.storage.models.ListSharesExpand; +import com.azure.resourcemanager.storage.models.ListContainersInclude; import java.util.List; import reactor.core.publisher.Mono; @@ -90,7 +90,7 @@ Mono> list( @PathParam("subscriptionId") String subscriptionId, @QueryParam("$maxpagesize") String maxpagesize, @QueryParam("$filter") String filter, - @QueryParam("$include") ListSharesExpand include, + @QueryParam("$include") ListContainersInclude include, Context context); @Headers({"Accept: application/json", "Content-Type: application/json"}) @@ -319,7 +319,11 @@ Mono> listNext( */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> listSinglePageAsync( - String resourceGroupName, String accountName, String maxpagesize, String filter, ListSharesExpand include) { + String resourceGroupName, + String accountName, + String maxpagesize, + String filter, + ListContainersInclude include) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -388,7 +392,7 @@ public Mono> listSinglePageAsync( String accountName, String maxpagesize, String filter, - ListSharesExpand include, + ListContainersInclude include, Context context) { if (this.client.getEndpoint() == null) { return Mono @@ -449,7 +453,11 @@ public Mono> listSinglePageAsync( */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listAsync( - String resourceGroupName, String accountName, String maxpagesize, String filter, ListSharesExpand include) { + String resourceGroupName, + String accountName, + String maxpagesize, + String filter, + ListContainersInclude include) { return new PagedFlux<>( () -> listSinglePageAsync(resourceGroupName, accountName, maxpagesize, filter, include), nextLink -> listNextSinglePageAsync(nextLink)); @@ -478,7 +486,7 @@ public PagedFlux listAsync( String accountName, String maxpagesize, String filter, - ListSharesExpand include, + ListContainersInclude include, Context context) { return new PagedFlux<>( () -> listSinglePageAsync(resourceGroupName, accountName, maxpagesize, filter, include, context), @@ -502,7 +510,7 @@ public PagedFlux listAsync( public PagedFlux listAsync(String resourceGroupName, String accountName) { final String maxpagesize = null; final String filter = null; - final ListSharesExpand include = null; + final ListContainersInclude include = null; final Context context = null; return new PagedFlux<>( () -> listSinglePageAsync(resourceGroupName, accountName, maxpagesize, filter, include), @@ -527,7 +535,11 @@ public PagedFlux listAsync(String resourceGroupName, Str */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list( - String resourceGroupName, String accountName, String maxpagesize, String filter, ListSharesExpand include) { + String resourceGroupName, + String accountName, + String maxpagesize, + String filter, + ListContainersInclude include) { return new PagedIterable<>(listAsync(resourceGroupName, accountName, maxpagesize, filter, include)); } @@ -554,7 +566,7 @@ public PagedIterable list( String accountName, String maxpagesize, String filter, - ListSharesExpand include, + ListContainersInclude include, Context context) { return new PagedIterable<>(listAsync(resourceGroupName, accountName, maxpagesize, filter, include, context)); } @@ -576,7 +588,7 @@ public PagedIterable list( public PagedIterable list(String resourceGroupName, String accountName) { final String maxpagesize = null; final String filter = null; - final ListSharesExpand include = null; + final ListContainersInclude include = null; final Context context = null; return new PagedIterable<>(listAsync(resourceGroupName, accountName, maxpagesize, filter, include)); } diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/fluent/ManagementPoliciesClient.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/fluent/ManagementPoliciesClient.java index 4f7c94dc296d7..e24a7e0c664b0 100644 --- a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/fluent/ManagementPoliciesClient.java +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/fluent/ManagementPoliciesClient.java @@ -24,14 +24,14 @@ import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.resources.fluentcore.collection.InnerSupportsDelete; import com.azure.resourcemanager.storage.StorageManagementClient; import com.azure.resourcemanager.storage.fluent.inner.ManagementPolicyInner; +import com.azure.resourcemanager.storage.models.ManagementPolicyName; import com.azure.resourcemanager.storage.models.ManagementPolicySchema; import reactor.core.publisher.Mono; /** An instance of this class provides access to all the operations defined in ManagementPolicies. */ -public final class ManagementPoliciesClient implements InnerSupportsDelete { +public final class ManagementPoliciesClient { private final ClientLogger logger = new ClientLogger(ManagementPoliciesClient.class); /** The proxy service used to perform REST calls. */ @@ -70,7 +70,7 @@ Mono> get( @PathParam("accountName") String accountName, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("managementPolicyName") String managementPolicyName, + @PathParam("managementPolicyName") ManagementPolicyName managementPolicyName, Context context); @Headers({"Accept: application/json", "Content-Type: application/json"}) @@ -85,7 +85,7 @@ Mono> createOrUpdate( @PathParam("accountName") String accountName, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("managementPolicyName") String managementPolicyName, + @PathParam("managementPolicyName") ManagementPolicyName managementPolicyName, @BodyParam("application/json") ManagementPolicyInner properties, Context context); @@ -101,7 +101,7 @@ Mono> delete( @PathParam("accountName") String accountName, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("managementPolicyName") String managementPolicyName, + @PathParam("managementPolicyName") ManagementPolicyName managementPolicyName, Context context); } @@ -112,13 +112,15 @@ Mono> delete( * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managementpolicy associated with the specified storage account. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(String resourceGroupName, String accountName) { + public Mono> getWithResponseAsync( + String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -138,7 +140,10 @@ public Mono> getWithResponseAsync(String resourc new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - final String managementPolicyName = "default"; + if (managementPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementPolicyName is required and cannot be null.")); + } return FluxUtil .withContext( context -> @@ -161,6 +166,7 @@ public Mono> getWithResponseAsync(String resourc * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -169,7 +175,7 @@ public Mono> getWithResponseAsync(String resourc */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getWithResponseAsync( - String resourceGroupName, String accountName, Context context) { + String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -189,7 +195,10 @@ public Mono> getWithResponseAsync( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - final String managementPolicyName = "default"; + if (managementPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementPolicyName is required and cannot be null.")); + } return service .get( this.client.getEndpoint(), @@ -208,14 +217,16 @@ public Mono> getWithResponseAsync( * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managementpolicy associated with the specified storage account. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAsync(String resourceGroupName, String accountName) { - return getWithResponseAsync(resourceGroupName, accountName) + public Mono getAsync( + String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName) { + return getWithResponseAsync(resourceGroupName, accountName, managementPolicyName) .flatMap( (Response res) -> { if (res.getValue() != null) { @@ -233,6 +244,7 @@ public Mono getAsync(String resourceGroupName, String acc * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -240,8 +252,9 @@ public Mono getAsync(String resourceGroupName, String acc * @return the managementpolicy associated with the specified storage account. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAsync(String resourceGroupName, String accountName, Context context) { - return getWithResponseAsync(resourceGroupName, accountName, context) + public Mono getAsync( + String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName, Context context) { + return getWithResponseAsync(resourceGroupName, accountName, managementPolicyName, context) .flatMap( (Response res) -> { if (res.getValue() != null) { @@ -259,14 +272,16 @@ public Mono getAsync(String resourceGroupName, String acc * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managementpolicy associated with the specified storage account. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ManagementPolicyInner get(String resourceGroupName, String accountName) { - return getAsync(resourceGroupName, accountName).block(); + public ManagementPolicyInner get( + String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName) { + return getAsync(resourceGroupName, accountName, managementPolicyName).block(); } /** @@ -276,6 +291,7 @@ public ManagementPolicyInner get(String resourceGroupName, String accountName) { * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -283,8 +299,9 @@ public ManagementPolicyInner get(String resourceGroupName, String accountName) { * @return the managementpolicy associated with the specified storage account. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ManagementPolicyInner get(String resourceGroupName, String accountName, Context context) { - return getAsync(resourceGroupName, accountName, context).block(); + public ManagementPolicyInner get( + String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName, Context context) { + return getAsync(resourceGroupName, accountName, managementPolicyName, context).block(); } /** @@ -294,6 +311,7 @@ public ManagementPolicyInner get(String resourceGroupName, String accountName, C * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @param policy The Storage Account ManagementPolicies Rules. See more details in: * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -303,7 +321,10 @@ public ManagementPolicyInner get(String resourceGroupName, String accountName, C */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> createOrUpdateWithResponseAsync( - String resourceGroupName, String accountName, ManagementPolicySchema policy) { + String resourceGroupName, + String accountName, + ManagementPolicyName managementPolicyName, + ManagementPolicySchema policy) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -323,10 +344,13 @@ public Mono> createOrUpdateWithResponseAsync( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } + if (managementPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementPolicyName is required and cannot be null.")); + } if (policy != null) { policy.validate(); } - final String managementPolicyName = "default"; ManagementPolicyInner properties = new ManagementPolicyInner(); properties.withPolicy(policy); return FluxUtil @@ -352,6 +376,7 @@ public Mono> createOrUpdateWithResponseAsync( * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @param policy The Storage Account ManagementPolicies Rules. See more details in: * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. * @param context The context to associate with this operation. @@ -362,7 +387,11 @@ public Mono> createOrUpdateWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> createOrUpdateWithResponseAsync( - String resourceGroupName, String accountName, ManagementPolicySchema policy, Context context) { + String resourceGroupName, + String accountName, + ManagementPolicyName managementPolicyName, + ManagementPolicySchema policy, + Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -382,10 +411,13 @@ public Mono> createOrUpdateWithResponseAsync( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } + if (managementPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementPolicyName is required and cannot be null.")); + } if (policy != null) { policy.validate(); } - final String managementPolicyName = "default"; ManagementPolicyInner properties = new ManagementPolicyInner(); properties.withPolicy(policy); return service @@ -407,6 +439,7 @@ public Mono> createOrUpdateWithResponseAsync( * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @param policy The Storage Account ManagementPolicies Rules. See more details in: * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -416,8 +449,11 @@ public Mono> createOrUpdateWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono createOrUpdateAsync( - String resourceGroupName, String accountName, ManagementPolicySchema policy) { - return createOrUpdateWithResponseAsync(resourceGroupName, accountName, policy) + String resourceGroupName, + String accountName, + ManagementPolicyName managementPolicyName, + ManagementPolicySchema policy) { + return createOrUpdateWithResponseAsync(resourceGroupName, accountName, managementPolicyName, policy) .flatMap( (Response res) -> { if (res.getValue() != null) { @@ -435,6 +471,7 @@ public Mono createOrUpdateAsync( * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @param policy The Storage Account ManagementPolicies Rules. See more details in: * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. * @param context The context to associate with this operation. @@ -445,8 +482,12 @@ public Mono createOrUpdateAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono createOrUpdateAsync( - String resourceGroupName, String accountName, ManagementPolicySchema policy, Context context) { - return createOrUpdateWithResponseAsync(resourceGroupName, accountName, policy, context) + String resourceGroupName, + String accountName, + ManagementPolicyName managementPolicyName, + ManagementPolicySchema policy, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, accountName, managementPolicyName, policy, context) .flatMap( (Response res) -> { if (res.getValue() != null) { @@ -464,6 +505,7 @@ public Mono createOrUpdateAsync( * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @param policy The Storage Account ManagementPolicies Rules. See more details in: * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -473,8 +515,11 @@ public Mono createOrUpdateAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) public ManagementPolicyInner createOrUpdate( - String resourceGroupName, String accountName, ManagementPolicySchema policy) { - return createOrUpdateAsync(resourceGroupName, accountName, policy).block(); + String resourceGroupName, + String accountName, + ManagementPolicyName managementPolicyName, + ManagementPolicySchema policy) { + return createOrUpdateAsync(resourceGroupName, accountName, managementPolicyName, policy).block(); } /** @@ -484,6 +529,7 @@ public ManagementPolicyInner createOrUpdate( * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @param policy The Storage Account ManagementPolicies Rules. See more details in: * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. * @param context The context to associate with this operation. @@ -494,8 +540,12 @@ public ManagementPolicyInner createOrUpdate( */ @ServiceMethod(returns = ReturnType.SINGLE) public ManagementPolicyInner createOrUpdate( - String resourceGroupName, String accountName, ManagementPolicySchema policy, Context context) { - return createOrUpdateAsync(resourceGroupName, accountName, policy, context).block(); + String resourceGroupName, + String accountName, + ManagementPolicyName managementPolicyName, + ManagementPolicySchema policy, + Context context) { + return createOrUpdateAsync(resourceGroupName, accountName, managementPolicyName, policy, context).block(); } /** @@ -505,13 +555,15 @@ public ManagementPolicyInner createOrUpdate( * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteWithResponseAsync(String resourceGroupName, String accountName) { + public Mono> deleteWithResponseAsync( + String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -531,7 +583,10 @@ public Mono> deleteWithResponseAsync(String resourceGroupName, St new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - final String managementPolicyName = "default"; + if (managementPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementPolicyName is required and cannot be null.")); + } return FluxUtil .withContext( context -> @@ -554,6 +609,7 @@ public Mono> deleteWithResponseAsync(String resourceGroupName, St * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -561,7 +617,8 @@ public Mono> deleteWithResponseAsync(String resourceGroupName, St * @return the completion. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteWithResponseAsync(String resourceGroupName, String accountName, Context context) { + public Mono> deleteWithResponseAsync( + String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -581,7 +638,10 @@ public Mono> deleteWithResponseAsync(String resourceGroupName, St new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - final String managementPolicyName = "default"; + if (managementPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementPolicyName is required and cannot be null.")); + } return service .delete( this.client.getEndpoint(), @@ -600,14 +660,17 @@ public Mono> deleteWithResponseAsync(String resourceGroupName, St * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteAsync(String resourceGroupName, String accountName) { - return deleteWithResponseAsync(resourceGroupName, accountName).flatMap((Response res) -> Mono.empty()); + public Mono deleteAsync( + String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName) { + return deleteWithResponseAsync(resourceGroupName, accountName, managementPolicyName) + .flatMap((Response res) -> Mono.empty()); } /** @@ -617,6 +680,7 @@ public Mono deleteAsync(String resourceGroupName, String accountName) { * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -624,8 +688,9 @@ public Mono deleteAsync(String resourceGroupName, String accountName) { * @return the completion. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteAsync(String resourceGroupName, String accountName, Context context) { - return deleteWithResponseAsync(resourceGroupName, accountName, context) + public Mono deleteAsync( + String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName, Context context) { + return deleteWithResponseAsync(resourceGroupName, accountName, managementPolicyName, context) .flatMap((Response res) -> Mono.empty()); } @@ -636,13 +701,14 @@ public Mono deleteAsync(String resourceGroupName, String accountName, Cont * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String accountName) { - deleteAsync(resourceGroupName, accountName).block(); + public void delete(String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName) { + deleteAsync(resourceGroupName, accountName, managementPolicyName).block(); } /** @@ -652,13 +718,15 @@ public void delete(String resourceGroupName, String accountName) { * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String accountName, Context context) { - deleteAsync(resourceGroupName, accountName, context).block(); + public void delete( + String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName, Context context) { + deleteAsync(resourceGroupName, accountName, managementPolicyName, context).block(); } } diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/fluent/inner/StorageAccountInner.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/fluent/inner/StorageAccountInner.java index c423a999ce1fd..522af210cef0a 100644 --- a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/fluent/inner/StorageAccountInner.java +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/fluent/inner/StorageAccountInner.java @@ -18,6 +18,7 @@ import com.azure.resourcemanager.storage.models.Identity; import com.azure.resourcemanager.storage.models.Kind; import com.azure.resourcemanager.storage.models.LargeFileSharesState; +import com.azure.resourcemanager.storage.models.MinimumTlsVersion; import com.azure.resourcemanager.storage.models.NetworkRuleSet; import com.azure.resourcemanager.storage.models.ProvisioningState; import com.azure.resourcemanager.storage.models.RoutingPreference; @@ -202,6 +203,20 @@ public class StorageAccountInner extends Resource { @JsonProperty(value = "properties.blobRestoreStatus", access = JsonProperty.Access.WRITE_ONLY) private BlobRestoreStatusInner blobRestoreStatus; + /* + * Allow or disallow public access to all blobs or containers in the + * storage account. The default interpretation is true for this property. + */ + @JsonProperty(value = "properties.allowBlobPublicAccess") + private Boolean allowBlobPublicAccess; + + /* + * Set the minimum TLS version to be permitted on requests to storage. The + * default interpretation is TLS 1.0 for this property. + */ + @JsonProperty(value = "properties.minimumTlsVersion") + private MinimumTlsVersion minimumTlsVersion; + /** * Get the sku property: Gets the SKU. * @@ -512,6 +527,50 @@ public BlobRestoreStatusInner blobRestoreStatus() { return this.blobRestoreStatus; } + /** + * Get the allowBlobPublicAccess property: Allow or disallow public access to all blobs or containers in the storage + * account. The default interpretation is true for this property. + * + * @return the allowBlobPublicAccess value. + */ + public Boolean allowBlobPublicAccess() { + return this.allowBlobPublicAccess; + } + + /** + * Set the allowBlobPublicAccess property: Allow or disallow public access to all blobs or containers in the storage + * account. The default interpretation is true for this property. + * + * @param allowBlobPublicAccess the allowBlobPublicAccess value to set. + * @return the StorageAccountInner object itself. + */ + public StorageAccountInner withAllowBlobPublicAccess(Boolean allowBlobPublicAccess) { + this.allowBlobPublicAccess = allowBlobPublicAccess; + return this; + } + + /** + * Get the minimumTlsVersion property: Set the minimum TLS version to be permitted on requests to storage. The + * default interpretation is TLS 1.0 for this property. + * + * @return the minimumTlsVersion value. + */ + public MinimumTlsVersion minimumTlsVersion() { + return this.minimumTlsVersion; + } + + /** + * Set the minimumTlsVersion property: Set the minimum TLS version to be permitted on requests to storage. The + * default interpretation is TLS 1.0 for this property. + * + * @param minimumTlsVersion the minimumTlsVersion value to set. + * @return the StorageAccountInner object itself. + */ + public StorageAccountInner withMinimumTlsVersion(MinimumTlsVersion minimumTlsVersion) { + this.minimumTlsVersion = minimumTlsVersion; + return this; + } + /** * Validates the instance. * diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/implementation/ManagementPoliciesImpl.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/implementation/ManagementPoliciesImpl.java index 2c636cbf010f8..aea25d5eaa80b 100644 --- a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/implementation/ManagementPoliciesImpl.java +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/implementation/ManagementPoliciesImpl.java @@ -9,6 +9,7 @@ import com.azure.resourcemanager.storage.models.ManagementPolicies; import com.azure.resourcemanager.storage.models.ManagementPolicy; import com.azure.resourcemanager.storage.fluent.inner.ManagementPolicyInner; +import com.azure.resourcemanager.storage.models.ManagementPolicyName; import reactor.core.publisher.Mono; public class ManagementPoliciesImpl extends WrapperImpl implements ManagementPolicies { @@ -38,11 +39,12 @@ private ManagementPolicyImpl wrapModel(String name) { @Override public Mono getAsync(String resourceGroupName, String accountName) { - return this.inner().getAsync(resourceGroupName, accountName).map(inner -> wrapModel(inner)); + return this.inner().getAsync(resourceGroupName, accountName, ManagementPolicyName.DEFAULT) + .map(inner -> wrapModel(inner)); } @Override public Mono deleteAsync(String resourceGroupName, String accountName) { - return this.inner().deleteAsync(resourceGroupName, accountName); + return this.inner().deleteAsync(resourceGroupName, accountName, ManagementPolicyName.DEFAULT); } } diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/implementation/ManagementPolicyImpl.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/implementation/ManagementPolicyImpl.java index bdd45ef996d0a..5e7ef0d469009 100644 --- a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/implementation/ManagementPolicyImpl.java +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/implementation/ManagementPolicyImpl.java @@ -10,6 +10,7 @@ import com.azure.resourcemanager.storage.models.BlobTypes; import com.azure.resourcemanager.storage.models.ManagementPolicy; import com.azure.resourcemanager.storage.models.ManagementPolicyBaseBlob; +import com.azure.resourcemanager.storage.models.ManagementPolicyName; import com.azure.resourcemanager.storage.models.ManagementPolicyRule; import com.azure.resourcemanager.storage.models.ManagementPolicySchema; import com.azure.resourcemanager.storage.models.ManagementPolicySnapShot; @@ -62,7 +63,7 @@ public StorageManager manager() { public Mono createResourceAsync() { ManagementPoliciesClient client = this.manager().inner().getManagementPolicies(); return client - .createOrUpdateAsync(this.resourceGroupName, this.accountName, cpolicy) + .createOrUpdateAsync(this.resourceGroupName, this.accountName, ManagementPolicyName.DEFAULT, cpolicy) .map( resource -> { resetCreateUpdateParameters(); @@ -75,7 +76,7 @@ public Mono createResourceAsync() { public Mono updateResourceAsync() { ManagementPoliciesClient client = this.manager().inner().getManagementPolicies(); return client - .createOrUpdateAsync(this.resourceGroupName, this.accountName, upolicy) + .createOrUpdateAsync(this.resourceGroupName, this.accountName, ManagementPolicyName.DEFAULT, upolicy) .map( resource -> { resetCreateUpdateParameters(); @@ -87,7 +88,7 @@ public Mono updateResourceAsync() { @Override protected Mono getInnerAsync() { ManagementPoliciesClient client = this.manager().inner().getManagementPolicies(); - return client.getAsync(this.resourceGroupName, this.accountName); + return client.getAsync(this.resourceGroupName, this.accountName, ManagementPolicyName.DEFAULT); } @Override diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/implementation/PolicyRuleImpl.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/implementation/PolicyRuleImpl.java index 1710a85fa1dcc..f0780ec02bccd 100644 --- a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/implementation/PolicyRuleImpl.java +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/implementation/PolicyRuleImpl.java @@ -15,6 +15,8 @@ import com.azure.resourcemanager.storage.models.ManagementPolicyRule; import com.azure.resourcemanager.storage.models.ManagementPolicySnapShot; import com.azure.resourcemanager.storage.models.PolicyRule; +import com.azure.resourcemanager.storage.models.RuleType; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -52,7 +54,7 @@ public String name() { } @Override - public String type() { + public RuleType type() { return this.inner.type(); } @@ -155,7 +157,7 @@ public ManagementPolicyRule inner() { @Override public PolicyRuleImpl withLifecycleRuleType() { - this.inner.withType("Lifecycle"); + this.inner.withType(RuleType.LIFECYCLE); return this; } diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/ListContainersInclude.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/ListContainersInclude.java new file mode 100644 index 0000000000000..c2af3fe2e9214 --- /dev/null +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/ListContainersInclude.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ListContainersInclude. */ +public final class ListContainersInclude extends ExpandableStringEnum { + /** Static value deleted for ListContainersInclude. */ + public static final ListContainersInclude DELETED = fromString("deleted"); + + /** + * Creates or finds a ListContainersInclude from its string representation. + * + * @param name a name to look for. + * @return the corresponding ListContainersInclude. + */ + @JsonCreator + public static ListContainersInclude fromString(String name) { + return fromString(name, ListContainersInclude.class); + } + + /** @return known ListContainersInclude values. */ + public static Collection values() { + return values(ListContainersInclude.class); + } +} diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/ManagementPolicyName.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/ManagementPolicyName.java new file mode 100644 index 0000000000000..bb8c037b53ffb --- /dev/null +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/ManagementPolicyName.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagementPolicyName. */ +public final class ManagementPolicyName extends ExpandableStringEnum { + /** Static value default for ManagementPolicyName. */ + public static final ManagementPolicyName DEFAULT = fromString("default"); + + /** + * Creates or finds a ManagementPolicyName from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagementPolicyName. + */ + @JsonCreator + public static ManagementPolicyName fromString(String name) { + return fromString(name, ManagementPolicyName.class); + } + + /** @return known ManagementPolicyName values. */ + public static Collection values() { + return values(ManagementPolicyName.class); + } +} diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/ManagementPolicyRule.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/ManagementPolicyRule.java index 34401ed344466..e53acc39f83fd 100644 --- a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/ManagementPolicyRule.java +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/ManagementPolicyRule.java @@ -31,7 +31,7 @@ public final class ManagementPolicyRule { * The valid value is Lifecycle */ @JsonProperty(value = "type", required = true) - private String type; + private RuleType type; /* * An object that defines the Lifecycle rule. @@ -39,11 +39,6 @@ public final class ManagementPolicyRule { @JsonProperty(value = "definition", required = true) private ManagementPolicyDefinition definition; - /** Creates an instance of ManagementPolicyRule class. */ - public ManagementPolicyRule() { - type = "Lifecycle"; - } - /** * Get the enabled property: Rule is enabled if set to true. * @@ -91,7 +86,7 @@ public ManagementPolicyRule withName(String name) { * * @return the type value. */ - public String type() { + public RuleType type() { return this.type; } @@ -101,7 +96,7 @@ public String type() { * @param type the type value to set. * @return the ManagementPolicyRule object itself. */ - public ManagementPolicyRule withType(String type) { + public ManagementPolicyRule withType(RuleType type) { this.type = type; return this; } @@ -137,6 +132,11 @@ public void validate() { .logExceptionAsError( new IllegalArgumentException("Missing required property name in model ManagementPolicyRule")); } + if (type() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model ManagementPolicyRule")); + } if (definition() == null) { throw logger .logExceptionAsError( diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/MinimumTlsVersion.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/MinimumTlsVersion.java new file mode 100644 index 0000000000000..4b60198570d24 --- /dev/null +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/MinimumTlsVersion.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for MinimumTlsVersion. */ +public final class MinimumTlsVersion extends ExpandableStringEnum { + /** Static value TLS1_0 for MinimumTlsVersion. */ + public static final MinimumTlsVersion TLS1_0 = fromString("TLS1_0"); + + /** Static value TLS1_1 for MinimumTlsVersion. */ + public static final MinimumTlsVersion TLS1_1 = fromString("TLS1_1"); + + /** Static value TLS1_2 for MinimumTlsVersion. */ + public static final MinimumTlsVersion TLS1_2 = fromString("TLS1_2"); + + /** + * Creates or finds a MinimumTlsVersion from its string representation. + * + * @param name a name to look for. + * @return the corresponding MinimumTlsVersion. + */ + @JsonCreator + public static MinimumTlsVersion fromString(String name) { + return fromString(name, MinimumTlsVersion.class); + } + + /** @return known MinimumTlsVersion values. */ + public static Collection values() { + return values(MinimumTlsVersion.class); + } +} diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/PolicyRule.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/PolicyRule.java index 8940c411f46e3..6226d6ca18a6b 100644 --- a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/PolicyRule.java +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/PolicyRule.java @@ -16,7 +16,7 @@ public interface PolicyRule extends HasInner { String name(); /** @return the type of the rule */ - String type(); + RuleType type(); /** @return an unmodifiable list of the blob types this rule will apply for */ List blobTypesToFilterFor(); diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/RuleType.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/RuleType.java new file mode 100644 index 0000000000000..18de5872c5430 --- /dev/null +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/RuleType.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RuleType. */ +public final class RuleType extends ExpandableStringEnum { + /** Static value Lifecycle for RuleType. */ + public static final RuleType LIFECYCLE = fromString("Lifecycle"); + + /** + * Creates or finds a RuleType from its string representation. + * + * @param name a name to look for. + * @return the corresponding RuleType. + */ + @JsonCreator + public static RuleType fromString(String name) { + return fromString(name, RuleType.class); + } + + /** @return known RuleType values. */ + public static Collection values() { + return values(RuleType.class); + } +} diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/StorageAccountCreateParameters.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/StorageAccountCreateParameters.java index 4824320bb83ae..67c6343dcb7eb 100644 --- a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/StorageAccountCreateParameters.java +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/StorageAccountCreateParameters.java @@ -117,6 +117,20 @@ public class StorageAccountCreateParameters { @JsonProperty(value = "properties.routingPreference") private RoutingPreference routingPreference; + /* + * Allow or disallow public access to all blobs or containers in the + * storage account. The default interpretation is true for this property. + */ + @JsonProperty(value = "properties.allowBlobPublicAccess") + private Boolean allowBlobPublicAccess; + + /* + * Set the minimum TLS version to be permitted on requests to storage. The + * default interpretation is TLS 1.0 for this property. + */ + @JsonProperty(value = "properties.minimumTlsVersion") + private MinimumTlsVersion minimumTlsVersion; + /** * Get the sku property: Required. Gets or sets the SKU name. * @@ -426,6 +440,50 @@ public StorageAccountCreateParameters withRoutingPreference(RoutingPreference ro return this; } + /** + * Get the allowBlobPublicAccess property: Allow or disallow public access to all blobs or containers in the storage + * account. The default interpretation is true for this property. + * + * @return the allowBlobPublicAccess value. + */ + public Boolean allowBlobPublicAccess() { + return this.allowBlobPublicAccess; + } + + /** + * Set the allowBlobPublicAccess property: Allow or disallow public access to all blobs or containers in the storage + * account. The default interpretation is true for this property. + * + * @param allowBlobPublicAccess the allowBlobPublicAccess value to set. + * @return the StorageAccountCreateParameters object itself. + */ + public StorageAccountCreateParameters withAllowBlobPublicAccess(Boolean allowBlobPublicAccess) { + this.allowBlobPublicAccess = allowBlobPublicAccess; + return this; + } + + /** + * Get the minimumTlsVersion property: Set the minimum TLS version to be permitted on requests to storage. The + * default interpretation is TLS 1.0 for this property. + * + * @return the minimumTlsVersion value. + */ + public MinimumTlsVersion minimumTlsVersion() { + return this.minimumTlsVersion; + } + + /** + * Set the minimumTlsVersion property: Set the minimum TLS version to be permitted on requests to storage. The + * default interpretation is TLS 1.0 for this property. + * + * @param minimumTlsVersion the minimumTlsVersion value to set. + * @return the StorageAccountCreateParameters object itself. + */ + public StorageAccountCreateParameters withMinimumTlsVersion(MinimumTlsVersion minimumTlsVersion) { + this.minimumTlsVersion = minimumTlsVersion; + return this; + } + /** * Validates the instance. * diff --git a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/StorageAccountUpdateParameters.java b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/StorageAccountUpdateParameters.java index 3a06f67a24a27..9c16308ea9919 100644 --- a/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/StorageAccountUpdateParameters.java +++ b/sdk/storage/mgmt/src/main/java/com/azure/resourcemanager/storage/models/StorageAccountUpdateParameters.java @@ -103,6 +103,20 @@ public class StorageAccountUpdateParameters { @JsonProperty(value = "properties.routingPreference") private RoutingPreference routingPreference; + /* + * Allow or disallow public access to all blobs or containers in the + * storage account. The default interpretation is true for this property. + */ + @JsonProperty(value = "properties.allowBlobPublicAccess") + private Boolean allowBlobPublicAccess; + + /* + * Set the minimum TLS version to be permitted on requests to storage. The + * default interpretation is TLS 1.0 for this property. + */ + @JsonProperty(value = "properties.minimumTlsVersion") + private MinimumTlsVersion minimumTlsVersion; + /** * Get the sku property: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, * Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any other value. @@ -366,6 +380,50 @@ public StorageAccountUpdateParameters withRoutingPreference(RoutingPreference ro return this; } + /** + * Get the allowBlobPublicAccess property: Allow or disallow public access to all blobs or containers in the storage + * account. The default interpretation is true for this property. + * + * @return the allowBlobPublicAccess value. + */ + public Boolean allowBlobPublicAccess() { + return this.allowBlobPublicAccess; + } + + /** + * Set the allowBlobPublicAccess property: Allow or disallow public access to all blobs or containers in the storage + * account. The default interpretation is true for this property. + * + * @param allowBlobPublicAccess the allowBlobPublicAccess value to set. + * @return the StorageAccountUpdateParameters object itself. + */ + public StorageAccountUpdateParameters withAllowBlobPublicAccess(Boolean allowBlobPublicAccess) { + this.allowBlobPublicAccess = allowBlobPublicAccess; + return this; + } + + /** + * Get the minimumTlsVersion property: Set the minimum TLS version to be permitted on requests to storage. The + * default interpretation is TLS 1.0 for this property. + * + * @return the minimumTlsVersion value. + */ + public MinimumTlsVersion minimumTlsVersion() { + return this.minimumTlsVersion; + } + + /** + * Set the minimumTlsVersion property: Set the minimum TLS version to be permitted on requests to storage. The + * default interpretation is TLS 1.0 for this property. + * + * @param minimumTlsVersion the minimumTlsVersion value to set. + * @return the StorageAccountUpdateParameters object itself. + */ + public StorageAccountUpdateParameters withMinimumTlsVersion(MinimumTlsVersion minimumTlsVersion) { + this.minimumTlsVersion = minimumTlsVersion; + return this; + } + /** * Validates the instance. *