コード例 #1
0
        public NamespaceAttributes UpdateNamespace(string resourceGroupName, string namespaceName, string location, string skuName, int?skuCapacity, Dictionary <string, string> tags)
        {
            var parameter = new NamespaceCreateOrUpdateParameters()
            {
                Location = location
            };

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

            Sku tempSku = new Sku();



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

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

            parameter.Sku = tempSku;

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

            return(new NamespaceAttributes(response));
        }
コード例 #2
0
 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;
     }
 }
コード例 #3
0
 public NamespaceAttributes(NamespaceResource evResource)
 {
     if (evResource != null)
     {
         Sku = evResource.Sku;
         ProvisioningState  = evResource.ProvisioningState;
         Status             = (Microsoft.Azure.Commands.EventHub.Models.NamespaceState)evResource.Status;
         CreatedAt          = evResource.CreatedAt;
         UpdatedAt          = evResource.UpdatedAt;
         ServiceBusEndpoint = evResource.ServiceBusEndpoint;
         Enabled            = evResource.Enabled;
         Location           = evResource.Location;
     }
 }
コード例 #4
0
 public NamespaceAttributes(NamespaceResource evResource)
 {
     if (evResource != null)
     {
         Sku = new Sku
         {
             Capacity = evResource.Sku.Capacity,
             Name     = evResource.Sku.Name,
             Tier     = evResource.Sku.Tier
         };
         if (evResource.ProvisioningState != null)
         {
             ProvisioningState = evResource.ProvisioningState;
         }
         if (evResource.Status.HasValue)
         {
             Status = (Microsoft.Azure.Commands.EventHub.Models.NamespaceState)evResource.Status;
         }
         if (evResource.CreatedAt.HasValue)
         {
             CreatedAt = evResource.CreatedAt;
         }
         if (evResource.UpdatedAt.HasValue)
         {
             UpdatedAt = evResource.UpdatedAt;
         }
         if (evResource.ServiceBusEndpoint != null)
         {
             ServiceBusEndpoint = evResource.ServiceBusEndpoint;
         }
         if (evResource.Enabled.HasValue)
         {
             Enabled = evResource.Enabled;
         }
         if (evResource.Location != null)
         {
             Location = evResource.Location;
         }
         if (evResource.Id != null)
         {
             Id = evResource.Id;
         }
         if (evResource.Name != null)
         {
             Name = evResource.Name;
         }
     }
 }
コード例 #5
0
        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;
                        }
                    }
                }
            }
        }
コード例 #6
0
 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;
     }
 }
コード例 #7
0
        public NamespaceAttributes BeginCreateNamespace(string resourceGroupName, string namespaceName, string location, string skuName, Dictionary <string, string> tags)
        {
            NamespaceCreateOrUpdateParameters parameter = new NamespaceCreateOrUpdateParameters();

            parameter.Location = location;

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

            if (skuName != null)
            {
                parameter.Sku = new Sku
                {
                    Name = skuName,
                    Tier = skuName
                };
            }

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

            return(new NamespaceAttributes(response));
        }
コード例 #8
0
        public NamespaceAttributes GetNamespace(string resourceGroupName, string namespaceName)
        {
            NamespaceResource response = Client.Namespaces.Get(resourceGroupName, namespaceName);

            return(new NamespaceAttributes(response));
        }