GetSizeInUserSpecificFormat() public static method

public static GetSizeInUserSpecificFormat ( string skuFamily, int skuCapacity ) : string
skuFamily string
skuCapacity int
return string
Exemplo n.º 1
0
        public RedisCacheAttributesWithAccessKeys(RedisResourceWithAccessKey cache, string resourceGroupName)
        {
            Id                 = cache.Id;
            Location           = cache.Location;
            Name               = cache.Name;
            Type               = cache.Type;
            HostName           = cache.HostName;
            Port               = cache.Port.HasValue ? cache.Port.Value : 0;
            ProvisioningState  = cache.ProvisioningState;
            SslPort            = cache.SslPort.HasValue ? cache.SslPort.Value : 0;
            RedisConfiguration = cache.RedisConfiguration;
            EnableNonSslPort   = cache.EnableNonSslPort.Value;
            RedisVersion       = cache.RedisVersion;
            Size               = SizeConverter.GetSizeInUserSpecificFormat(cache.Sku.Family, cache.Sku.Capacity);
            Sku                = cache.Sku.Name;

            PrimaryKey        = cache.AccessKeys.PrimaryKey;
            SecondaryKey      = cache.AccessKeys.SecondaryKey;
            ResourceGroupName = resourceGroupName;

            VirtualNetwork = cache.VirtualNetwork;
            Subnet         = cache.Subnet;
            StaticIP       = cache.StaticIP;
            TenantSettings = cache.TenantSettings;
            ShardCount     = cache.ShardCount;
        }
 public RedisCacheAttributes(RedisGetResponse cache, string resourceGroupName)
 {
     Id                = cache.Id;
     Location          = cache.Location;
     Name              = cache.Name;
     Type              = cache.Type;
     HostName          = cache.Properties.HostName;
     Port              = cache.Properties.Port;
     ProvisioningState = cache.Properties.ProvisioningState;
     SslPort           = cache.Properties.SslPort;
     MaxMemoryPolicy   = cache.Properties.MaxMemoryPolicy;
     RedisVersion      = cache.Properties.RedisVersion;
     Size              = SizeConverter.GetSizeInUserSpecificFormat(cache.Properties.Sku.Family, cache.Properties.Sku.Capacity);
     Sku               = cache.Properties.Sku.Name;
     ResourceGroupName = resourceGroupName;
 }
Exemplo n.º 3
0
 public RedisCacheAttributes(RedisResource cache, string resourceGroupName)
 {
     Id                 = cache.Id;
     Location           = cache.Location;
     Name               = cache.Name;
     Type               = cache.Type;
     HostName           = cache.Properties.HostName;
     Port               = cache.Properties.Port;
     ProvisioningState  = cache.Properties.ProvisioningState;
     SslPort            = cache.Properties.SslPort;
     RedisConfiguration = cache.Properties.RedisConfiguration;
     EnableNonSslPort   = cache.Properties.EnableNonSslPort.Value;
     RedisVersion       = cache.Properties.RedisVersion;
     Size               = SizeConverter.GetSizeInUserSpecificFormat(cache.Properties.Sku.Family, cache.Properties.Sku.Capacity);
     Sku                = cache.Properties.Sku.Name;
     ResourceGroupName  = resourceGroupName;
 }
        public RedisCacheAttributesWithAccessKeys(RedisCreateOrUpdateResponse cache, string resourceGroupName)
        {
            Id                = cache.Id;
            Location          = cache.Location;
            Name              = cache.Name;
            Type              = cache.Type;
            HostName          = cache.Properties.HostName;
            Port              = cache.Properties.Port;
            ProvisioningState = cache.Properties.ProvisioningState;
            SslPort           = cache.Properties.SslPort;
            MaxMemoryPolicy   = cache.Properties.MaxMemoryPolicy;
            EnableNonSslPort  = cache.Properties.EnableNonSslPort;
            RedisVersion      = cache.Properties.RedisVersion;
            Size              = SizeConverter.GetSizeInUserSpecificFormat(cache.Properties.Sku.Family, cache.Properties.Sku.Capacity);
            Sku               = cache.Properties.Sku.Name;

            PrimaryKey        = cache.Properties.AccessKeys.PrimaryKey;
            SecondaryKey      = cache.Properties.AccessKeys.SecondaryKey;
            ResourceGroupName = resourceGroupName;
        }
 public RedisCacheAttributes(RedisResource cache, string resourceGroupName)
 {
     Id                 = cache.Id;
     Location           = cache.Location;
     Name               = cache.Name;
     Type               = cache.Type;
     HostName           = cache.Properties.HostName;
     Port               = cache.Properties.Port;
     ProvisioningState  = cache.Properties.ProvisioningState;
     SslPort            = cache.Properties.SslPort;
     RedisConfiguration = cache.Properties.RedisConfiguration;
     EnableNonSslPort   = cache.Properties.EnableNonSslPort.Value;
     RedisVersion       = cache.Properties.RedisVersion;
     Size               = SizeConverter.GetSizeInUserSpecificFormat(cache.Properties.Sku.Family, cache.Properties.Sku.Capacity);
     Sku                = cache.Properties.Sku.Name;
     ResourceGroupName  = resourceGroupName;
     VirtualNetwork     = cache.Properties.VirtualNetwork;
     Subnet             = cache.Properties.Subnet;
     StaticIP           = cache.Properties.StaticIP;
     TenantSettings     = cache.Properties.TenantSettings;
     ShardCount         = cache.Properties.ShardCount;
 }
Exemplo n.º 6
0
 public RedisCacheAttributes(RedisResource cache, string resourceGroupName)
 {
     Id                 = cache.Id;
     Location           = cache.Location;
     Name               = cache.Name;
     Type               = cache.Type;
     HostName           = cache.HostName;
     Port               = cache.Port.HasValue ? cache.Port.Value : 0;
     ProvisioningState  = cache.ProvisioningState;
     SslPort            = cache.SslPort.HasValue ? cache.SslPort.Value : 0;
     RedisConfiguration = cache.RedisConfiguration;
     EnableNonSslPort   = cache.EnableNonSslPort.Value;
     RedisVersion       = cache.RedisVersion;
     Size               = SizeConverter.GetSizeInUserSpecificFormat(cache.Sku.Family, cache.Sku.Capacity);
     Sku                = cache.Sku.Name;
     ResourceGroupName  = resourceGroupName;
     SubnetId           = cache.SubnetId;
     StaticIP           = cache.StaticIP;
     TenantSettings     = cache.TenantSettings;
     ShardCount         = cache.ShardCount;
     Tag                = cache.Tags;
     Zone               = cache.Zones;
 }
        public RedisCacheAttributes(RedisResource cache, string resourceGroupName)
        {
            Id                = cache.Id;
            Location          = cache.Location;
            Name              = cache.Name;
            Type              = cache.Type;
            HostName          = cache.HostName;
            Port              = cache.Port.HasValue ? cache.Port.Value : 0;
            ProvisioningState = cache.ProvisioningState;
            SslPort           = cache.SslPort.HasValue ? cache.SslPort.Value : 0;

            EnableNonSslPort = cache.EnableNonSslPort.Value;
            RedisVersion     = cache.RedisVersion;
            Size             = SizeConverter.GetSizeInUserSpecificFormat(cache.Sku.Family, cache.Sku.Capacity);
            Sku = cache.Sku.Name;
            ResourceGroupName = resourceGroupName;
            SubnetId          = cache.SubnetId;
            StaticIP          = cache.StaticIP;
            TenantSettings    = cache.TenantSettings;
            ShardCount        = cache.ShardCount;
            MinimumTlsVersion = cache.MinimumTlsVersion;
            Tag  = cache.Tags;
            Zone = cache.Zones;
            RedisConfiguration = new Dictionary <string, string>();

            // Converting cache.RedisConfiguration Object into a readable dictionary using the json attributes
            if (cache.RedisConfiguration != null)
            {
                foreach (PropertyInfo property in cache.RedisConfiguration.GetType().GetProperties())
                {
                    System.Attribute attr = property.GetCustomAttribute(typeof(JsonPropertyAttribute));
                    if (property.GetValue(cache.RedisConfiguration) != null && attr != null)
                    {
                        JsonPropertyAttribute jsonAttr = (JsonPropertyAttribute)attr;
                        RedisConfiguration[jsonAttr.PropertyName] = (string)property.GetValue(cache.RedisConfiguration);
                    }
                }
                if (cache.RedisConfiguration.AdditionalProperties != null)
                {
                    foreach (KeyValuePair <string, object> kvPair in cache.RedisConfiguration.AdditionalProperties)
                    {
                        RedisConfiguration[kvPair.Key] = (string)kvPair.Value;
                    }
                }
            }

            // Converting cache.Identity Object into a readable SystemAssignedIdenty dictionary and UserAssignedIdentities list
            if (cache.Identity != null)
            {
                IdentityType = "";
                if (cache.Identity.PrincipalId != null)
                {
                    SystemAssignedIdentity = new Dictionary <string, string>
                    {
                        { nameof(cache.Identity.PrincipalId), cache.Identity.PrincipalId.ToString() },
                        { nameof(cache.Identity.TenantId), cache.Identity.TenantId.ToString() }
                    };
                    IdentityType = nameof(ManagedServiceIdentityType.SystemAssigned);
                }
                if (cache.Identity.UserAssignedIdentities?.Count > 0)
                {
                    UserAssignedIdentity = new List <string>();
                    foreach (var identity in cache.Identity.UserAssignedIdentities)
                    {
                        UserAssignedIdentity.Add(identity.Key);
                    }
                    if (nameof(ManagedServiceIdentityType.SystemAssigned).Equals(IdentityType))
                    {
                        IdentityType = nameof(ManagedServiceIdentityType.SystemAssignedUserAssigned);
                    }
                    else
                    {
                        IdentityType = nameof(ManagedServiceIdentityType.UserAssigned);
                    }
                }
            }
        }