public override void ExecuteCmdlet() { EventHubAttributes eventHub = new EventHubAttributes(); if (InputObject != null) { eventHub = InputObject; } else { if (string.IsNullOrEmpty(Name)) { eventHub.Name = Name; } if (messageRetentionInDays.HasValue) { eventHub.MessageRetentionInDays = messageRetentionInDays; } if (partitionCount.HasValue) { eventHub.PartitionCount = partitionCount; } } if (ShouldProcess(target: Name, action: string.Format(Resources.UpdateEventHub, Name, Namespace))) { WriteObject(Client.CreateOrUpdateEventHub(ResourceGroupName, Namespace, Name, eventHub)); } }
public override void ExecuteCmdlet() { SharedAccessAuthorizationRuleAttributes sasRule = new SharedAccessAuthorizationRuleAttributes(); if (AuthRuleObj != null) { sasRule = AuthRuleObj; } else { EventHubAttributes getEventHub = Client.GetEventHub(ResourceGroupName, NamespaceName, EventHubName); IList <Management.EventHub.Models.AccessRights?> newListAry = new List <Management.EventHub.Models.AccessRights?>(); foreach (string test in Rights) { newListAry.Add(ParseAccessRights(test)); } sasRule.Name = AuthorizationRuleName; sasRule.Rights = newListAry; sasRule.Location = getEventHub.Location; } // Update a eventHub authorizationRule if (ShouldProcess(target: AuthorizationRuleName, action: string.Format("Update AuthorizationRule:{0} of Eventhub:{1} of NameSpace:{2}", AuthorizationRuleName, EventHubName, NamespaceName))) { WriteObject(Client.CreateOrUpdateEventHubAuthorizationRules(ResourceGroupName, NamespaceName, EventHubName, sasRule.Name, sasRule)); } }
public override void ExecuteCmdlet() { EventHubAttributes eventHub = null; if (EventHubObj != null) { eventHub = EventHubObj; } else { if (string.IsNullOrEmpty(EventHubName)) { eventHub.Name = EventHubName; } if (messageRetentionInDays.HasValue) { eventHub.MessageRetentionInDays = messageRetentionInDays; } if (partitionCount.HasValue) { eventHub.PartitionCount = partitionCount; } } eventHub.Location = Client.GetNamespace(ResourceGroupName, NamespaceName).Location; if (ShouldProcess(target: EventHubName, action: string.Format("Updating EventHub:{0} of NameSpace:{1}", EventHubName, NamespaceName))) { WriteObject(Client.CreateOrUpdateEventHub(ResourceGroupName, NamespaceName, eventHub.Name, eventHub)); } }
public override void ExecuteCmdlet() { EventHubAttributes eventHub = new EventHubAttributes(); if (EventHubObj != null) { eventHub = EventHubObj; } else { if (!string.IsNullOrEmpty(EventHubName)) { eventHub.Name = EventHubName; } if (MessageRetentionInDays.HasValue) { eventHub.MessageRetentionInDays = MessageRetentionInDays; } if (PartitionCount.HasValue) { eventHub.PartitionCount = PartitionCount; } eventHub.Location = Location; } if (ShouldProcess(target: eventHub.Name, action: string.Format("Creating new EventHub:{0} under NameSpace:{1} ", eventHub.Name, NamespaceName))) { WriteObject(Client.CreateOrUpdateEventHub(ResourceGroupName, NamespaceName, eventHub.Name, eventHub)); } }
/// <summary> /// /// </summary> public override void ExecuteCmdlet() { if (!string.IsNullOrEmpty(Name)) { // Get a EventHub EventHubAttributes eventHub = Client.GetEventHub(ResourceGroupName, Namespace, Name); WriteObject(eventHub); } else { // Get all EventHubs IEnumerable <EventHubAttributes> eventHubsList = Client.ListAllEventHubs(ResourceGroupName, Namespace); WriteObject(eventHubsList.ToList(), true); } }
public override void ExecuteCmdlet() { ConsumerGroupAttributes consumerGroup = new ConsumerGroupAttributes(); EventHubAttributes getEventHub = Client.GetEventHub(ResourceGroupName, NamespaceName, EventHubName); consumerGroup.Name = ConsumerGroupName; consumerGroup.Location = getEventHub.Location; if (!string.IsNullOrEmpty(UserMetadata)) { consumerGroup.UserMetadata = UserMetadata; } if (ShouldProcess(target: consumerGroup.Name, action: string.Format("Updating ConsumerGroup: {0} for the Eventhub:{1}", consumerGroup.Name, EventHubName))) { WriteObject(Client.CreateOrUpdateConsumerGroup(ResourceGroupName, NamespaceName, EventHubName, consumerGroup.Name, consumerGroup)); } }
public override void ExecuteCmdlet() { SharedAccessAuthorizationRuleAttributes sasRule = new SharedAccessAuthorizationRuleAttributes(); EventHubAttributes getEventHub = Client.GetEventHub(ResourceGroupName, NamespaceName, EventHubName); IList <Management.EventHub.Models.AccessRights?> newListAry = new List <Management.EventHub.Models.AccessRights?>(); foreach (string test in Rights) { newListAry.Add(ParseAccessRights(test)); } sasRule.Name = AuthorizationRuleName; sasRule.Rights = newListAry; sasRule.Location = getEventHub.Location; // Create a new eventHub authorizationRule if (ShouldProcess(target: sasRule.Name, action: string.Format("Creating new AuthorizationRule named:{0} for EventHub: {1}", sasRule.Name, EventHubName))) { WriteObject(Client.CreateOrUpdateEventHubAuthorizationRules(ResourceGroupName, NamespaceName, EventHubName, sasRule.Name, sasRule)); } }
public EventHubAttributes CreateOrUpdateEventHub(string resourceGroupName, string namespaceName, string eventHubName, EventHubAttributes parameter) { var Parameter1 = new EventHubCreateOrUpdateParameters() { Name = parameter.Name, Location = parameter.Location, Properties = new EventHubProperties() }; if (parameter.CreatedAt.HasValue) { Parameter1.Properties.CreatedAt = parameter.CreatedAt; } if (parameter.MessageRetentionInDays.HasValue) { Parameter1.Properties.MessageRetentionInDays = parameter.MessageRetentionInDays; } if (parameter.PartitionCount.HasValue) { Parameter1.Properties.PartitionCount = parameter.PartitionCount; } if (parameter.PartitionIds != null) { Parameter1.Properties.PartitionIds = parameter.PartitionIds; } if (parameter.Status.HasValue) { Parameter1.Properties.Status = parameter.Status; } if (parameter.UpdatedAt.HasValue) { Parameter1.Properties.UpdatedAt = parameter.UpdatedAt; } var response = Client.EventHubs.CreateOrUpdate(resourceGroupName, namespaceName, eventHubName, Parameter1); return(new EventHubAttributes(response)); }
public EventHubAttributes CreateOrUpdateEventHub(string resourceGroupName, string namespaceName, string eventHubName, EventHubAttributes parameter) { var Parameter1 = new Management.EventHub.Models.Eventhub(); if (parameter.MessageRetentionInDays.HasValue) { Parameter1.MessageRetentionInDays = parameter.MessageRetentionInDays; } if (parameter.PartitionCount.HasValue) { Parameter1.PartitionCount = parameter.PartitionCount; } if (parameter.Status.HasValue) { Parameter1.Status = parameter.Status; } if (parameter.CaptureDescription != null) { Parameter1.CaptureDescription = new CaptureDescription(); Parameter1.CaptureDescription.Destination = new Destination(); Parameter1.CaptureDescription.Enabled = parameter.CaptureDescription.Enabled; Parameter1.CaptureDescription.Encoding = (Management.EventHub.Models.EncodingCaptureDescription?)parameter.CaptureDescription.Encoding; Parameter1.CaptureDescription.IntervalInSeconds = parameter.CaptureDescription.IntervalInSeconds; Parameter1.CaptureDescription.SizeLimitInBytes = parameter.CaptureDescription.SizeLimitInBytes; Parameter1.CaptureDescription.Destination.Name = parameter.CaptureDescription.Destination.Name; Parameter1.CaptureDescription.Destination.BlobContainer = parameter.CaptureDescription.Destination.BlobContainer; Parameter1.CaptureDescription.Destination.ArchiveNameFormat = parameter.CaptureDescription.Destination.ArchiveNameFormat; Parameter1.CaptureDescription.Destination.StorageAccountResourceId = parameter.CaptureDescription.Destination.StorageAccountResourceId; } var response = Client.EventHubs.CreateOrUpdate(resourceGroupName, namespaceName, eventHubName, Parameter1); return(new EventHubAttributes(response)); }