public PSNamespaceAttributes UpdateNamespace(string resourceGroupName, string namespaceName, string location, string skuName, int?skuCapacity, Dictionary <string, string> tags)
        {
            var parameter = new SBNamespace()
            {
                Location = location
            };

            if (tags != null)
            {
                parameter.Tags = new Dictionary <string, string>(tags);
            }

            SBSku tempSku = new SBSku();



            if (skuName != null)
            {
                tempSku.Name = AzureServiceBusCmdletBase.ParseSkuName(skuName);
                tempSku.Tier = AzureServiceBusCmdletBase.ParseSkuTier(skuName);
            }

            if (skuCapacity != null)
            {
                tempSku.Capacity = skuCapacity;
            }

            parameter.Sku = tempSku;

            SBNamespace response = Client.Namespaces.CreateOrUpdate(resourceGroupName, namespaceName, parameter);

            return(new PSNamespaceAttributes(response));
        }
Exemple #2
0
 public PSNamespaceAttributes(SBNamespace evResource)
 {
     if (evResource != null)
     {
         Sku = new SBSku {
             Capacity = evResource.Sku.Capacity,
             Name     = evResource.Sku.Name,
             Tier     = evResource.Sku.Tier
         };
         if (evResource.ProvisioningState != null)
         {
             ProvisioningState = evResource.ProvisioningState;
         }
         if (evResource.CreatedAt.HasValue)
         {
             CreatedAt = evResource.CreatedAt;
         }
         if (evResource.UpdatedAt.HasValue)
         {
             UpdatedAt = evResource.UpdatedAt;
         }
         if (evResource.ServiceBusEndpoint != null)
         {
             ServiceBusEndpoint = evResource.ServiceBusEndpoint;
         }
         if (evResource.Location != null)
         {
             Location = evResource.Location;
         }
         if (evResource.Name != null)
         {
             Name = evResource.Name;
         }
         if (evResource.Id != null)
         {
             Id = evResource.Id;
         }
         ResourceGroup     = Regex.Split(evResource.Id, @"/")[4];
         ResourceGroupName = Regex.Split(evResource.Id, @"/")[4];
         Tags             = new Dictionary <string, string>(evResource.Tags);
         ZoneRedundant    = evResource.ZoneRedundant;
         DisableLocalAuth = evResource.DisableLocalAuth;
     }
 }
Exemple #3
0
        public NamespaceAttributes(SBNamespace evResource)
        {
            if (evResource != null)
            {
                Sku = new SBSku {
                    Capacity = evResource.Sku.Capacity,
                    Name     = evResource.Sku.Name,
                    Tier     = evResource.Sku.Tier
                };
                if (evResource.ProvisioningState != null)
                {
                    ProvisioningState = evResource.ProvisioningState;
                }
                if (evResource.CreatedAt.HasValue)
                {
                    CreatedAt = evResource.CreatedAt;
                }
                if (evResource.UpdatedAt.HasValue)
                {
                    UpdatedAt = evResource.UpdatedAt;
                }
                if (evResource.ServiceBusEndpoint != null)
                {
                    ServiceBusEndpoint = evResource.ServiceBusEndpoint;
                }
                if (evResource.Location != null)
                {
                    Location = evResource.Location;
                }
                if (evResource.Name != null)
                {
                    Name = evResource.Name;
                }
                if (evResource.Id != null)
                {
                    Id = evResource.Id;
                }
#pragma warning disable 612, 618
                Status  = Microsoft.Azure.Commands.ServiceBus.Models.NamespaceState.Active;
                Enabled = true;
#pragma warning restore 612, 618
                ResourceGroup = Regex.Split(evResource.Id, @"/")[4];
            }
        }
 public NamespaceAttributes(SBNamespace evResource)
 {
     if (evResource != null)
     {
         Sku = new SBSku {
             Capacity = evResource.Sku.Capacity,
             Name     = evResource.Sku.Name,
             Tier     = evResource.Sku.Tier
         };
         if (evResource.ProvisioningState != null)
         {
             ProvisioningState = evResource.ProvisioningState;
         }
         if (evResource.CreatedAt.HasValue)
         {
             CreatedAt = evResource.CreatedAt;
         }
         if (evResource.UpdatedAt.HasValue)
         {
             UpdatedAt = evResource.UpdatedAt;
         }
         if (evResource.ServiceBusEndpoint != null)
         {
             ServiceBusEndpoint = evResource.ServiceBusEndpoint;
         }
         if (evResource.Location != null)
         {
             Location = evResource.Location;
         }
         if (evResource.Name != null)
         {
             Name = evResource.Name;
         }
         if (evResource.Id != null)
         {
             Id = evResource.Id;
         }
         ResourceGroup = Regex.Split(evResource.Id, @"/")[4];
     }
 }
        public PSNamespaceAttributes(SBNamespace evResource)
        {
            if (evResource != null)
            {
                Sku = new SBSku {
                    Capacity = evResource.Sku.Capacity,
                    Name     = evResource.Sku.Name,
                    Tier     = evResource.Sku.Tier
                };

                if (evResource.ProvisioningState != null)
                {
                    ProvisioningState = evResource.ProvisioningState;
                }

                if (evResource.CreatedAt.HasValue)
                {
                    CreatedAt = evResource.CreatedAt;
                }

                if (evResource.UpdatedAt.HasValue)
                {
                    UpdatedAt = evResource.UpdatedAt;
                }

                if (evResource.ServiceBusEndpoint != null)
                {
                    ServiceBusEndpoint = evResource.ServiceBusEndpoint;
                }

                if (evResource.Location != null)
                {
                    Location = evResource.Location;
                }

                if (evResource.Name != null)
                {
                    Name = evResource.Name;
                }

                if (evResource.Id != null)
                {
                    Id = evResource.Id;
                }

                if (evResource.Identity != null)
                {
                    Identity = new PSIdentityAttributes(evResource.Identity);

                    IdentityType = evResource.Identity.Type.ToString();

                    if (evResource.Identity.UserAssignedIdentities != null)
                    {
                        IdentityId = evResource.Identity.UserAssignedIdentities.Keys.ToArray();
                    }
                }


                if (evResource.Encryption != null)
                {
                    if (evResource.Encryption.KeyVaultProperties != null)
                    {
                        EncryptionConfig = evResource.Encryption.KeyVaultProperties.Where(x => x != null).Select(x => {
                            PSEncryptionConfigAttributes kvproperty = new PSEncryptionConfigAttributes(x);

                            return(kvproperty);
                        }).ToArray();
                    }
                }

                if (evResource.Tags != null)
                {
                    var tagDictionary = new Dictionary <string, string>(evResource.Tags);
                    Tag = new Hashtable(tagDictionary);
                }

                ResourceGroup     = Regex.Split(evResource.Id, @"/")[4];
                ResourceGroupName = Regex.Split(evResource.Id, @"/")[4];
                Tags = new Dictionary <string, string>(evResource.Tags);
                if (evResource.ZoneRedundant != null)
                {
                    ZoneRedundant = evResource.ZoneRedundant;
                }
                DisableLocalAuth = evResource.DisableLocalAuth;
            }
        }