public override void ExecuteCmdlet() { try { if (!string.IsNullOrEmpty(Name)) { PSTopicAttributes topicAttributes = Client.GetTopic(ResourceGroupName, Namespace, Name); WriteObject(topicAttributes); } else { if (MaxCount.HasValue) { IEnumerable <PSTopicAttributes> topicAttributes = Client.ListTopics(ResourceGroupName, Namespace, MaxCount); WriteObject(topicAttributes, true); } else { IEnumerable <PSTopicAttributes> topicAttributes = Client.ListTopics(ResourceGroupName, Namespace); WriteObject(topicAttributes, true); } } } catch (Management.ServiceBus.Models.ErrorResponseException ex) { WriteError(ServiceBusClient.WriteErrorforBadrequest(ex)); } }
public override void ExecuteCmdlet() { if (!string.IsNullOrEmpty(Name)) { PSTopicAttributes topicAttributes = Client.GetTopic(ResourceGroupName, Namespace, Name); WriteObject(topicAttributes); } else { IEnumerable <PSTopicAttributes> topicAttributes = Client.ListTopics(ResourceGroupName, Namespace); WriteObject(topicAttributes, true); } }
public override void ExecuteCmdlet() { PSTopicAttributes topicAttributes = new PSTopicAttributes(); if (InputObject != null) { topicAttributes = InputObject; } if (ShouldProcess(target: Name, action: string.Format(Resources.UpdateTopic, Name, Namespace))) { WriteObject(Client.CreateUpdateTopic(ResourceGroupName, Namespace, topicAttributes.Name, topicAttributes)); } }
public override void ExecuteCmdlet() { PSTopicAttributes topicAttributes = new PSTopicAttributes(); if (InputObject != null) { topicAttributes = InputObject; } if (ShouldProcess(target: Name, action: string.Format(Resources.UpdateTopic, Name, Namespace))) { try { WriteObject(Client.CreateUpdateTopic(ResourceGroupName, Namespace, topicAttributes.Name, topicAttributes)); } catch (ErrorResponseException ex) { WriteError(ServiceBusClient.WriteErrorforBadrequest(ex)); } } }
public override void ExecuteCmdlet() { try { PSCheckNameAvailabilityResultAttributes checkNameresult = new PSCheckNameAvailabilityResultAttributes(); try { if (ParameterSetName.Equals(QueueCheckNameAvailabilityParameterSet) && Queue.IsPresent) { PSQueueAttributes getQueueResult = Client.GetQueue(ResourceGroupName, Namespace, Name); if (getQueueResult.Name.Equals(Name)) { WriteObject(false); } } if (ParameterSetName.Equals(TopicCheckNameAvailabilityParameterSet) && Topic.IsPresent) { PSTopicAttributes getTopicResult = Client.GetTopic(ResourceGroupName, Namespace, Name); if (getTopicResult.Name.Equals(Name)) { WriteObject(false); } } } catch (ErrorResponseException ex) { if (ex.Message.ToLower().Contains("notfound")) { WriteObject(true); } } } catch (ErrorResponseException ex) { WriteError(ServiceBusClient.WriteErrorforBadrequest(ex)); } }
public PSTopicAttributes CreateUpdateTopic(string resourceGroupName, string namespaceName, string topicName, PSTopicAttributes topic) { var parameters = new SBTopic(); if (topic.AutoDeleteOnIdle != null) { parameters.AutoDeleteOnIdle = (TimeSpan?)AzureServiceBusCmdletBase.ParseTimespan(topic.AutoDeleteOnIdle); } if (topic.DefaultMessageTimeToLive != null) { parameters.DefaultMessageTimeToLive = (TimeSpan?)AzureServiceBusCmdletBase.ParseTimespan(topic.DefaultMessageTimeToLive); } if (topic.DuplicateDetectionHistoryTimeWindow != null) { parameters.DuplicateDetectionHistoryTimeWindow = (TimeSpan?)AzureServiceBusCmdletBase.ParseTimespan(topic.DuplicateDetectionHistoryTimeWindow); } if (topic.EnableBatchedOperations != null) { parameters.EnableBatchedOperations = topic.EnableBatchedOperations; } if (topic.EnableExpress != null) { parameters.EnableExpress = topic.EnableExpress; } if (topic.EnablePartitioning != null) { parameters.EnablePartitioning = topic.EnablePartitioning; } if (topic.MaxSizeInMegabytes != null) { parameters.MaxSizeInMegabytes = topic.MaxSizeInMegabytes; } if (topic.RequiresDuplicateDetection != null) { parameters.RequiresDuplicateDetection = topic.RequiresDuplicateDetection; } if (topic.Status != null) { parameters.Status = topic.Status; } if (topic.SupportOrdering != null) { parameters.SupportOrdering = topic.SupportOrdering; } var response = Client.Topics.CreateOrUpdate(resourceGroupName, namespaceName, topicName, parameters); return(new PSTopicAttributes(response)); }
public override void ExecuteCmdlet() { PSTopicAttributes topicAttributes = new PSTopicAttributes(); PSNamespaceAttributes getNamespaceLoc = Client.GetNamespace(ResourceGroupName, Namespace); topicAttributes.Name = Name; if (EnablePartitioning != null) { topicAttributes.EnablePartitioning = EnablePartitioning; } if (AutoDeleteOnIdle != null) { topicAttributes.AutoDeleteOnIdle = AutoDeleteOnIdle; } if (DefaultMessageTimeToLive != null) { topicAttributes.DefaultMessageTimeToLive = DefaultMessageTimeToLive; } if (DuplicateDetectionHistoryTimeWindow != null) { topicAttributes.DuplicateDetectionHistoryTimeWindow = DuplicateDetectionHistoryTimeWindow; } if (EnableBatchedOperations != null) { topicAttributes.EnableBatchedOperations = EnableBatchedOperations; } if (EnableExpress != null) { topicAttributes.EnableExpress = EnableExpress; } if (MaxSizeInMegabytes != null) { topicAttributes.MaxSizeInMegabytes = (int?)MaxSizeInMegabytes; } if (RequiresDuplicateDetection != null) { topicAttributes.RequiresDuplicateDetection = RequiresDuplicateDetection; } if (SupportOrdering != null) { topicAttributes.SupportOrdering = SupportOrdering; } if (SizeInBytes != null) { topicAttributes.SizeInBytes = SizeInBytes; } if (ShouldProcess(target: Name, action: string.Format(Resources.CreateTopic, Name, Namespace))) { try { WriteObject(Client.CreateUpdateTopic(ResourceGroupName, Namespace, Name, topicAttributes)); } catch (ErrorResponseException ex) { WriteError(ServiceBusClient.WriteErrorforBadrequest(ex)); } } }