Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the ValidateAddress class.
 /// </summary>
 /// <param name="shippingAddress">Shipping address of the
 /// customer.</param>
 /// <param name="deviceType">Device type to be used for the job.
 /// Possible values include: 'DataBox', 'DataBoxDisk',
 /// 'DataBoxHeavy'</param>
 /// <param name="transportPreferences">Preferences related to the
 /// shipment logistics of the sku.</param>
 public ValidateAddress(ShippingAddress shippingAddress, SkuName deviceType, TransportPreferences transportPreferences = default(TransportPreferences))
 {
     ShippingAddress      = shippingAddress;
     DeviceType           = deviceType;
     TransportPreferences = transportPreferences;
     CustomInit();
 }
 /// <summary>
 /// Initializes a new instance of the SkuAvailabilityValidationRequest
 /// class.
 /// </summary>
 /// <param name="deviceType">Device type to be used for the job.
 /// Possible values include: 'DataBox', 'DataBoxDisk',
 /// 'DataBoxHeavy'</param>
 /// <param name="country">ISO country code. Country for hardware
 /// shipment. For codes check:
 /// https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements</param>
 /// <param name="location">Location for data transfer. For locations
 /// check:
 /// https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01</param>
 public SkuAvailabilityValidationRequest(SkuName deviceType, string country, string location)
 {
     DeviceType = deviceType;
     Country    = country;
     Location   = location;
     CustomInit();
 }
 /// <summary>
 /// Initializes a new instance of the SBSku class.
 /// </summary>
 /// <param name="name">Name of this SKU. Possible values include:
 /// 'Basic', 'Standard', 'Premium'</param>
 /// <param name="tier">The billing tier of this particular SKU.
 /// Possible values include: 'Basic', 'Standard', 'Premium'</param>
 /// <param name="capacity">The specified messaging units for the tier.
 /// For Premium tier, capacity are 1,2 and 4.</param>
 public SBSku(SkuName name, SkuTier?tier = default(SkuTier?), int?capacity = default(int?))
 {
     Name     = name;
     Tier     = tier;
     Capacity = capacity;
     CustomInit();
 }
Exemple #4
0
        public override void ExecuteCmdlet()
        {
            var skuN = new SkuName(Sku);
            PurchaseRequestPropertiesReservedResourceProperties resourceProperties = new PurchaseRequestPropertiesReservedResourceProperties(InstanceFlexibility);
            PurchaseRequest PurchaseRequest = new PurchaseRequest();

            PurchaseRequest.Location         = Location;
            PurchaseRequest.Quantity         = Quantity;
            PurchaseRequest.Renew            = Renew;
            PurchaseRequest.Term             = Term;
            PurchaseRequest.AppliedScopeType = AppliedScopeType;

            if (AppliedScope != null)
            {
                PurchaseRequest.AppliedScopes = new List <string>()
                {
                    AppliedScope
                };
            }
            PurchaseRequest.BillingScopeId             = BillingScopeId;
            PurchaseRequest.BillingPlan                = BillingPlan;
            PurchaseRequest.DisplayName                = DisplayName;
            PurchaseRequest.Sku                        = skuN;
            PurchaseRequest.ReservedResourceProperties = resourceProperties;
            PurchaseRequest.ReservedResourceType       = ReservedResourceType;

            var response = AzureReservationAPIClient.ReservationOrder.Calculate(PurchaseRequest);
            var prop     = new PSCalculatePriceResponseProperties(response.Properties);

            WriteObject(prop);
        }
Exemple #5
0
        public override void ExecuteCmdlet()
        {
            var             skuN            = new SkuName(Sku);
            PurchaseRequest PurchaseRequest = new PurchaseRequest();
            PurchaseRequestPropertiesReservedResourceProperties resourceProperties = new PurchaseRequestPropertiesReservedResourceProperties(InstanceFlexibility);

            PurchaseRequest.Location         = Location;
            PurchaseRequest.Quantity         = Quantity;
            PurchaseRequest.Renew            = Renew;
            PurchaseRequest.Term             = Term;
            PurchaseRequest.AppliedScopeType = AppliedScopeType;

            if (AppliedScope != null)
            {
                PurchaseRequest.AppliedScopes = new List <string>()
                {
                    AppliedScope
                };
            }
            PurchaseRequest.BillingScopeId             = BillingScopeId;
            PurchaseRequest.BillingPlan                = BillingPlan;
            PurchaseRequest.DisplayName                = DisplayName;
            PurchaseRequest.Sku                        = skuN;
            PurchaseRequest.ReservedResourceProperties = resourceProperties;
            PurchaseRequest.ReservedResourceType       = ReservedResourceType;

            var resourceInfo = $"Reservation order {ReservationOrderId}";

            if (ShouldProcess(resourceInfo, "Purchase"))
            {
                var response = AzureReservationAPIClient.ReservationOrder.Purchase(ReservationOrderId, PurchaseRequest);
                WriteObject(response);
            }
        }
Exemple #6
0
        private void ValidateVault(
            Vault vault,
            string expectedVaultName,
            string expectedResourceGroupName,
            string expectedSubId,
            Guid expectedTenantId,
            string expectedLocation,
            string expectedSkuFamily,
            SkuName expectedSku,
            bool expectedEnabledForDeployment,
            bool expectedEnabledForTemplateDeployment,
            bool expectedEnabledForDiskEncryption,
            bool?expectedEnableSoftDelete,
            AccessPolicyEntry[] expectedPolicies,
            Dictionary <string, string> expectedTags)
        {
            Assert.NotNull(vault);
            Assert.NotNull(vault.Properties);

            string resourceIdFormat   = "/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.KeyVault/vaults/{2}";
            string expectedResourceId = string.Format(resourceIdFormat, expectedSubId, expectedResourceGroupName, expectedVaultName);

            Assert.Equal(expectedResourceId, vault.Id);
            Assert.Equal(expectedLocation, vault.Location);
            Assert.Equal(expectedTenantId, vault.Properties.TenantId);
            Assert.Equal(expectedSku, vault.Properties.Sku.Name);
            Assert.Equal(expectedVaultName, vault.Name);
            Assert.Equal(expectedEnabledForDeployment, vault.Properties.EnabledForDeployment);
            Assert.Equal(expectedEnabledForTemplateDeployment, vault.Properties.EnabledForTemplateDeployment);
            Assert.Equal(expectedEnabledForDiskEncryption, vault.Properties.EnabledForDiskEncryption);
            Assert.Equal(expectedEnableSoftDelete, vault.Properties.EnableSoftDelete);
            Assert.True(expectedTags.DictionaryEqual(vault.Tags));
            Assert.True(expectedPolicies.IsEqual(vault.Properties.AccessPolicies));
        }
Exemple #7
0
 /// <summary>
 /// Initializes a new instance of the Sku class.
 /// </summary>
 /// <param name="name">The sku name. Possible values include:
 /// 'DataBox', 'DataBoxDisk', 'DataBoxHeavy'</param>
 /// <param name="displayName">The display name of the sku.</param>
 /// <param name="family">The sku family.</param>
 public Sku(SkuName name, string displayName = default(string), string family = default(string))
 {
     Name        = name;
     DisplayName = displayName;
     Family      = family;
     CustomInit();
 }
Exemple #8
0
        internal static string ToSerializedValue(this SkuName value)
        {
            switch (value)
            {
            case SkuName.Free:
                return("free");

            case SkuName.Basic:
                return("basic");

            case SkuName.Standard:
                return("standard");

            case SkuName.Standard2:
                return("standard2");

            case SkuName.Standard3:
                return("standard3");

            case SkuName.StorageOptimizedL1:
                return("storage_optimized_l1");

            case SkuName.StorageOptimizedL2:
                return("storage_optimized_l2");
            }
            return(null);
        }
 /// <summary>
 /// Initializes a new instance of the
 /// DataTransferDetailsValidationRequest class.
 /// </summary>
 /// <param name="deviceType">Device type. Possible values include:
 /// 'DataBox', 'DataBoxDisk', 'DataBoxHeavy'</param>
 /// <param name="transferType">Type of the transfer. Possible values
 /// include: 'ImportToAzure', 'ExportFromAzure'</param>
 /// <param name="dataExportDetails">List of DataTransfer details to be
 /// used to export data from azure.</param>
 /// <param name="dataImportDetails">List of DataTransfer details to be
 /// used to import data to azure.</param>
 public DataTransferDetailsValidationRequest(SkuName deviceType, TransferType transferType, IList <DataExportDetails> dataExportDetails = default(IList <DataExportDetails>), IList <DataImportDetails> dataImportDetails = default(IList <DataImportDetails>))
 {
     DataExportDetails = dataExportDetails;
     DataImportDetails = dataImportDetails;
     DeviceType        = deviceType;
     TransferType      = transferType;
     CustomInit();
 }
Exemple #10
0
 /// <summary>
 /// Creates event hub namespace sku.
 /// </summary>
 /// <param name="name">Sku name.</param>
 /// <param name="tier">Sku tier.</param>
 ///GENMHASH:CDE5022F600459C09E74303AF1358498:DA9435990EB5B4F9D93F540EB6E44B17
 public EventHubNamespaceSkuType(SkuName name, SkuTier tier) : this(new Sku()
 {
     Name = name,
     Tier = tier,
     Capacity = null
 })
 {
 }
 ///GENMHASH:B5E3D903BDA1F2A62441339A3042D8F4:E59E1393C8B2F3C07E87C9F34E983726
 public VaultImpl WithSku(SkuName skuName)
 {
     if (Inner.Properties == null)
     {
         Inner.Properties = new VaultProperties();
     }
     Inner.Properties.Sku = new Sku(skuName);
     return(this);
 }
        private SearchService CreateServiceForSku(SearchManagementClient searchMgmt, SkuName sku)
        {
            string serviceName = SearchTestUtilities.GenerateServiceName();

            SearchService service = DefineServiceWithSku(sku);

            service = searchMgmt.Services.BeginCreateOrUpdate(Data.ResourceGroupName, serviceName, service);
            Assert.NotNull(service);

            return(service);
        }
 /// <summary>
 /// Initializes a new instance of the Sku class.
 /// </summary>
 /// <param name="name">Gets or sets the sku name. Required for account
 /// creation; optional for update. Note that in older versions, sku
 /// name was called accountType. Possible values include:
 /// 'Standard_LRS', 'Standard_GRS', 'Standard_RAGRS', 'Standard_ZRS',
 /// 'Premium_LRS'</param>
 /// <param name="tier">Gets the sku tier. This is based on the SKU
 /// name. Possible values include: 'Standard', 'Premium'</param>
 /// <param name="resourceType">The type of the resource, usually it is
 /// 'storageAccounts'.</param>
 /// <param name="kind">Indicates the type of storage account. Possible
 /// values include: 'Storage', 'StorageV2', 'BlobStorage'</param>
 /// <param name="locations">The set of locations that the SKU is
 /// available. This will be supported and registered Azure Geo Regions
 /// (e.g. West US, East US, Southeast Asia, etc.).</param>
 /// <param name="capabilities">The capability information in the
 /// specified sku, including file encryption, network acls, change
 /// notification, etc.</param>
 /// <param name="restrictions">The restrictions because of which SKU
 /// cannot be used. This is empty if there are no restrictions.</param>
 public Sku(SkuName name, SkuTier?tier = default(SkuTier?), string resourceType = default(string), Kind?kind = default(Kind?), IList <string> locations = default(IList <string>), IList <SKUCapability> capabilities = default(IList <SKUCapability>), IList <Restriction> restrictions = default(IList <Restriction>))
 {
     Name         = name;
     Tier         = tier;
     ResourceType = resourceType;
     Kind         = kind;
     Locations    = locations;
     Capabilities = capabilities;
     Restrictions = restrictions;
     CustomInit();
 }
Exemple #14
0
        /// <summary>
        /// Updates the storage account
        /// </summary>
        /// <param name="rgname">Resource Group Name</param>
        /// <param name="acctName">Account Name</param>
        /// <param name="storageMgmtClient"></param>
        private static void UpdateStorageAccountSku(string rgname, string acctName, SkuName skuName, StorageManagementClient storageMgmtClient)
        {
            Console.WriteLine("Updating storage account...");
            // Update storage account sku
            var parameters = new StorageAccountUpdateParameters
            {
                Sku = new Sku(skuName)
            };
            var storageAccount = storageMgmtClient.StorageAccounts.Update(rgname, acctName, parameters);

            Console.WriteLine("Sku on storage account updated to " + storageAccount.Sku.Name);
        }
        internal static string ToSerializedValue(this SkuName value)
        {
            switch (value)
            {
            case SkuName.Standard:
                return("standard");

            case SkuName.Premium:
                return("premium");
            }
            return(null);
        }
 private SearchService DefineServiceWithSku(SkuName sku)
 {
     return(new SearchService()
     {
         Location = Data.Location,
         Sku = new Sku()
         {
             Name = sku
         },
         ReplicaCount = 1,
         PartitionCount = 1
     });
 }
 private SearchService DefineServiceWithSkuInPrivateMode(SkuName sku)
 {
     return(new SearchService()
     {
         Location = "EastUS",
         Sku = new Sku()
         {
             Name = sku
         },
         ReplicaCount = 1,
         PartitionCount = 1,
         PublicNetworkAccess = PublicNetworkAccess.Disabled
     });
 }
Exemple #18
0
        internal static string ToSerializedValue(this SkuName value)
        {
            switch (value)
            {
            case SkuName.F0:
                return("F0");

            case SkuName.S1:
                return("S1");

            case SkuName.C0:
                return("C0");
            }
            return(null);
        }
        internal static string ToSerializedValue(this SkuName value)
        {
            switch (value)
            {
            case SkuName.DataBox:
                return("DataBox");

            case SkuName.DataBoxDisk:
                return("DataBoxDisk");

            case SkuName.DataBoxHeavy:
                return("DataBoxHeavy");
            }
            return(null);
        }
 ///GENMHASH:B5E3D903BDA1F2A62441339A3042D8F4:ACEB925626760D001C056B5F56BA838D
 public StorageAccountImpl WithSku(SkuName skuName)
 {
     if (IsInCreateMode)
     {
         createParameters.Sku = new Sku
         {
             Name = skuName
         };
     }
     else
     {
         updateParameters.Sku = new Sku
         {
             Name = skuName
         };
     }
     return(this);
 }
Exemple #21
0
        private void ValidateVault(
            Vault vault,
            string expectedVaultName,
            string expectedResourceGroupName,
            string expectedSubId,
            Guid expectedTenantId,
            string expectedLocation,
            string expectedSkuFamily,
            SkuName expectedSku,
            bool expectedEnabledForDeployment,
            bool expectedEnabledForTemplateDeployment,
            bool expectedEnabledForDiskEncryption,
            bool?expectedEnableSoftDelete,
            AccessPolicyEntry[] expectedPolicies,
            NetworkRuleSet networkRuleSet,
            Dictionary <string, string> expectedTags,
            SystemData expectedSystemData)
        {
            ValidateVault(
                vault,
                expectedVaultName,
                expectedResourceGroupName,
                expectedSubId,
                expectedTenantId,
                expectedLocation,
                expectedSkuFamily,
                expectedSku,
                expectedEnabledForDeployment,
                expectedEnabledForTemplateDeployment,
                expectedEnabledForDiskEncryption,
                expectedEnableSoftDelete,
                expectedPolicies,
                expectedTags,
                expectedSystemData);

            Assert.NotNull(vault.Properties.NetworkAcls);
            Assert.Equal(networkRuleSet.DefaultAction, vault.Properties.NetworkAcls.DefaultAction);
            Assert.Equal(networkRuleSet.Bypass, vault.Properties.NetworkAcls.Bypass);
            Assert.True(vault.Properties.NetworkAcls.IpRules != null && vault.Properties.NetworkAcls.IpRules.Count == 2);
            Assert.Equal(networkRuleSet.IpRules[0].Value, vault.Properties.NetworkAcls.IpRules[0].Value);
            Assert.Equal(networkRuleSet.IpRules[1].Value, vault.Properties.NetworkAcls.IpRules[1].Value);
        }
Exemple #22
0
        internal static Sku DeserializeSku(JsonElement element)
        {
            string  family = default;
            SkuName name   = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("family"))
                {
                    family = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString().ToSkuName();
                    continue;
                }
            }
            return(new Sku(family, name));
        }
        internal static string ToSerializedValue(this SkuName value)
        {
            switch (value)
            {
            case SkuName.StandardLRS:
                return("Standard_LRS");

            case SkuName.StandardGRS:
                return("Standard_GRS");

            case SkuName.StandardRAGRS:
                return("Standard_RAGRS");

            case SkuName.StandardZRS:
                return("Standard_ZRS");

            case SkuName.PremiumLRS:
                return("Premium_LRS");
            }
            return(null);
        }
        internal static string ToSerializedValue(this SkuName value)
        {
            switch (value)
            {
            case SkuName.NotSpecified:
                return("NotSpecified");

            case SkuName.Free:
                return("Free");

            case SkuName.Shared:
                return("Shared");

            case SkuName.Basic:
                return("Basic");

            case SkuName.Standard:
                return("Standard");

            case SkuName.Premium:
                return("Premium");
            }
            return(null);
        }
Exemple #25
0
        internal static ServiceBusSku DeserializeServiceBusSku(JsonElement element)
        {
            SkuName            name     = default;
            Optional <SkuTier> tier     = default;
            Optional <int>     capacity = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString().ToSkuName();
                    continue;
                }
                if (property.NameEquals("tier"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    tier = property.Value.GetString().ToSkuTier();
                    continue;
                }
                if (property.NameEquals("capacity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    capacity = property.Value.GetInt32();
                    continue;
                }
            }
            return(new ServiceBusSku(name, Optional.ToNullable(tier), Optional.ToNullable(capacity)));
        }
 private void TestCreateServiceForSku(SkuName sku) => TestCreateService(DefineServiceWithSku(sku));
 /// <summary>
 /// Updates the storage account
 /// </summary>
 /// <param name="rgname">Resource Group Name</param>
 /// <param name="acctName">Account Name</param>
 /// <param name="storageMgmtClient"></param>
 private static void UpdateStorageAccountSku(string rgname, string acctName, SkuName skuName, StorageManagementClient storageMgmtClient)
 {
     Console.WriteLine("Updating storage account...");
     // Update storage account sku
     var parameters = new StorageAccountUpdateParameters
     {
         Sku = new Sku(skuName)
     };
     var storageAccount = storageMgmtClient.StorageAccounts.Update(rgname, acctName, parameters);
     Console.WriteLine("Sku on storage account updated to " + storageAccount.Sku.Name);
 }
 /// <summary>
 /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider"
 /// /> and <see cref="ignoreCase" />
 /// </summary>
 /// <param name="sourceValue">the <see cref="System.Object"/> to convert from</param>
 /// <param name="destinationType">the <see cref="System.Type" /> to convert to</param>
 /// <param name="formatProvider">not used by this TypeConverter.</param>
 /// <param name="ignoreCase">when set to <c>true</c>, will ignore the case when converting.</param>
 /// <returns>
 /// an instance of <see cref="SkuName" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => SkuName.CreateFrom(sourceValue);
Exemple #29
0
 internal Sku(SkuName name, SkuTier?tier, int?capacity)
 {
     Name     = name;
     Tier     = tier;
     Capacity = capacity;
 }
Exemple #30
0
 public Sku(SkuName name)
 {
     Name = name;
 }
 /// <summary>
 /// Specifies the sku of the key vault.
 /// </summary>
 /// <param name="skuName">The sku.</param>
 /// <return>The next stage of key vault definition.</return>
 Microsoft.Azure.Management.KeyVault.Fluent.Vault.Definition.IWithCreate Microsoft.Azure.Management.KeyVault.Fluent.Vault.Definition.IWithSku.WithSku(SkuName skuName)
 {
     return(this.WithSku(skuName) as Microsoft.Azure.Management.KeyVault.Fluent.Vault.Definition.IWithCreate);
 }