public NamespaceAttributes(NamespaceResource nsResource)
 {
     if (nsResource != null)
     {
         Id = nsResource.Id;
         Name = nsResource.Name;
         Type = nsResource.Type;
         Location = nsResource.Location;
         if (nsResource.Tags != null && nsResource.Tags.Count > 0)
         {
             Tags = new Dictionary<string, string>(nsResource.Tags);
         }
         CreatedAt = nsResource.CreatedAt;
         Critical = nsResource.Critical;
         Enabled = nsResource.Enabled;
         NamespaceType = nsResource.NamespaceType;
         ProvisioningState = nsResource.ProvisioningState;
         Region = nsResource.Region;
         ScaleUnit = nsResource.ScaleUnit;
         if (!string.IsNullOrEmpty(nsResource.ServiceBusEndpoint))
         {
             ServiceBusEndpoint = new Uri(nsResource.ServiceBusEndpoint);
         }
         Status = nsResource.Status;
         SubscriptionId = nsResource.SubscriptionId;
     }
 }
 public NamespaceAttributes(NamespaceResource nsResource)
 {
     if (nsResource != null)
     {
         Id = nsResource.Id;
         Name = nsResource.Name;
         Type = nsResource.Type;
         Location = nsResource.Location;
         Tags = new Dictionary<string, string>(nsResource.Tags);
         CreatedAt = nsResource.Properties.CreatedAt;
         Critical = nsResource.Properties.Critical;
         Enabled = nsResource.Properties.Enabled;
         NamespaceType = nsResource.Properties.NamespaceType;
         ProvisioningState = nsResource.Properties.ProvisioningState;
         Region = nsResource.Properties.Region;
         ScaleUnit = nsResource.Properties.ScaleUnit;
         ServiceBusEndpoint = nsResource.Properties.ServiceBusEndpoint;
         Status = nsResource.Properties.Status;
         SubscriptionId = nsResource.Properties.SubscriptionId;
     }
 }
        public NamespaceAttributes(string resourceGroup, NamespaceResource nsResource)
            :this(nsResource)
        {
            if (nsResource != null)
            {
                ResourceGroupName = resourceGroup;

                if (!string.IsNullOrWhiteSpace(nsResource.Id))
                {
                    var match = ResourceGroupRegex.Match(Id);
                    if (match.Success)
                    {
                        var resourceGroupNameGroup = match.Groups["resourceGroupName"];
                        if (resourceGroupNameGroup != null && resourceGroupNameGroup.Success)
                        {
                            ResourceGroupName = resourceGroupNameGroup.Value;
                        }
                    }
                }
            }
        }