Example #1
0
 public override void ExecuteCmdlet()
 {
     try
     {
         if (!string.IsNullOrEmpty(Name))
         {
             // Get a ConsumnerGroup
             PSConsumerGroupAttributes consumergroupAttributesList = Client.GetConsumerGroup(ResourceGroupName, Namespace, EventHub, Name);
             WriteObject(consumergroupAttributesList);
         }
         else
         {
             if (MaxCount.HasValue)
             {
                 // Get all ConsumnerGroups
                 IEnumerable <PSConsumerGroupAttributes> consumergroupAttributesList = Client.ListAllConsumerGroup(ResourceGroupName, Namespace, EventHub, MaxCount);
                 WriteObject(consumergroupAttributesList.ToList(), true);
             }
             else
             {
                 // Get all ConsumnerGroups
                 IEnumerable <PSConsumerGroupAttributes> consumergroupAttributesList = Client.ListAllConsumerGroup(ResourceGroupName, Namespace, EventHub);
                 WriteObject(consumergroupAttributesList.ToList(), true);
             }
         }
     }
     catch (Management.EventHub.Models.ErrorResponseException ex)
     {
         WriteError(Eventhub.EventHubsClient.WriteErrorforBadrequest(ex));
     }
 }
Example #2
0
        public override void ExecuteCmdlet()
        {
            PSConsumerGroupAttributes consumerGroup = new PSConsumerGroupAttributes();

            if (!string.IsNullOrEmpty(UserMetadata))
            {
                consumerGroup.UserMetadata = UserMetadata;
            }

            if (ShouldProcess(target: Name, action: string.Format(Resources.CreateConsumerGroup, Name, EventHub)))
            {
                WriteObject(Client.CreateOrUpdateConsumerGroup(ResourceGroupName, Namespace, EventHub, Name, consumerGroup));
            }
        }
 public override void ExecuteCmdlet()
 {
     if (!string.IsNullOrEmpty(Name))
     {
         // Get a ConsumnerGroup
         PSConsumerGroupAttributes consumergroupAttributesList = Client.GetConsumerGroup(ResourceGroupName, Namespace, EventHub, Name);
         WriteObject(consumergroupAttributesList);
     }
     else
     {
         // Get all ConsumnerGroups
         IEnumerable <PSConsumerGroupAttributes> consumergroupAttributesList = Client.ListAllConsumerGroup(ResourceGroupName, Namespace, EventHub);
         WriteObject(consumergroupAttributesList.ToList(), true);
     }
 }
Example #4
0
        public override void ExecuteCmdlet()
        {
            PSConsumerGroupAttributes consumerGroup = new PSConsumerGroupAttributes();

            if (!string.IsNullOrEmpty(UserMetadata))
            {
                consumerGroup.UserMetadata = UserMetadata;
            }

            if (ShouldProcess(target: Name, action: string.Format(Resources.CreateConsumerGroup, Name, EventHub)))
            {
                try
                {
                    WriteObject(Client.CreateOrUpdateConsumerGroup(ResourceGroupName, Namespace, EventHub, Name, consumerGroup));
                }
                catch (Management.EventHub.Models.ErrorResponseException ex)
                {
                    WriteError(Eventhub.EventHubsClient.WriteErrorforBadrequest(ex));
                }
            }
        }
        public PSConsumerGroupAttributes CreateOrUpdateConsumerGroup(string resourceGroupName, string namespaceName, string eventHubName, string consumerGroupName, PSConsumerGroupAttributes parameter)
        {
            var Parameter1 = new ConsumerGroup()
            {
                UserMetadata = parameter.UserMetadata
            };
            var response = Client.ConsumerGroups.CreateOrUpdate(resourceGroupName, namespaceName, eventHubName, consumerGroupName, Parameter1);

            return(new PSConsumerGroupAttributes(response));
        }