/// <inheritdoc/> public SetQueueAttributesResponse SetAttributes(QueueAttributes attributes) { return(AggregateExceptionExtract.Extract(() => { return SetAttributesAsync(attributes).Result; })); }
public async Task <SetQueueAttributesResponse> SetAttributesAsync(QueueAttributes attributes) { var request = new SetQueueAttributesRequest { Attributes = attributes }; return(await SetAttributesAsync(request).ConfigureAwait(false)); }
/// <inheritdoc/> public SetQueueAttributesResponse SetAttributes(QueueAttributes attributes) { var request = new SetQueueAttributesRequest { Attributes = attributes }; return(SetAttributes(request)); }
public override WebServiceResponse Unmarshall(XmlUnmarshallerContext context) { XmlTextReader reader = new XmlTextReader(context.ResponseStream); QueueAttributes attributes = new QueueAttributes(); while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: switch (reader.LocalName) { case MNSConstants.XML_ELEMENT_QUEUE_NAME: attributes.QueueName = reader.ReadElementContentAsString(); break; case MNSConstants.XML_ELEMENT_CREATE_TIME: attributes.CreateTime = AliyunSDKUtils.ConvertFromUnixEpochSeconds(reader.ReadElementContentAsLong()); break; case MNSConstants.XML_ELEMENT_LAST_MODIFY_TIME: attributes.LastModifyTime = AliyunSDKUtils.ConvertFromUnixEpochSeconds(reader.ReadElementContentAsLong()); break; case MNSConstants.XML_ELEMENT_VISIBILITY_TIMEOUT: attributes.VisibilityTimeout = (uint)reader.ReadElementContentAsInt(); break; case MNSConstants.XML_ELEMENT_MAXIMUM_MESSAGE_SIZE: attributes.MaximumMessageSize = (uint)reader.ReadElementContentAsInt(); break; case MNSConstants.XML_ELEMENT_MESSAGE_RETENTION_PERIOD: attributes.MessageRetentionPeriod = (uint)reader.ReadElementContentAsInt(); break; case MNSConstants.XML_ELEMENT_DELAY_SECONDS: attributes.DelaySeconds = (uint)reader.ReadElementContentAsInt(); break; case MNSConstants.XML_ELEMENT_POLLING_WAIT_SECONDS: attributes.PollingWaitSeconds = (uint)reader.ReadElementContentAsInt(); break; case MNSConstants.XML_ELEMENT_INACTIVE_MESSAGES: attributes.InactiveMessages = (uint)reader.ReadElementContentAsInt(); break; case MNSConstants.XML_ELEMENT_ACTIVE_MESSAGES: attributes.ActiveMessages = (uint)reader.ReadElementContentAsInt(); break; case MNSConstants.ATTRIBUTE_DELAY_MESSAGES: attributes.DelayMessages = (uint)reader.ReadElementContentAsInt(); break; } break; } } reader.Close(); return new GetQueueAttributesResponse() { Attributes = attributes }; }
public override string ToString() { return(string.Join(", ", new[] { $"name: {EntityName}", Durable ? "durable" : "", AutoDelete ? "auto-delete" : "", QueueAttributes.Any() ? $"attributes: {string.Join(";", QueueAttributes.Select(a => $"{a.Key}={a.Value}"))}" : "", QueueSubscriptionAttributes.Any() ? $"subscription-attributes: {string.Join(";", QueueSubscriptionAttributes.Select(a => $"{a.Key}={a.Value}"))}" : "" }.Where(x => !string.IsNullOrWhiteSpace(x)))); }
public override void ExecuteCmdlet() { QueueAttributes queueAttributes = new QueueAttributes(); if (InputObject != null) { NamespaceAttributes getNamespaceLoc = Client.GetNamespace(ResourceGroupName, Namespace); queueAttributes = InputObject; } if (ShouldProcess(target: Name, action: string.Format(Resources.UpdateQueue, Name, Namespace))) { WriteObject(Client.CreateUpdateQueue(ResourceGroupName, Namespace, queueAttributes.Name, queueAttributes)); } }
public override void ExecuteCmdlet() { QueueAttributes queueAttributes = new QueueAttributes(); if (QueueObj != null) { NamespaceAttributes getNamespaceLoc = Client.GetNamespace(ResourceGroup, NamespaceName); QueueObj.Location = getNamespaceLoc.Location; queueAttributes = QueueObj; } if (ShouldProcess(target: QueueName, action: string.Format("Updating Queue:{0} of the NameSpace:{1}", QueueName, NamespaceName))) { WriteObject(Client.CreateUpdateQueue(ResourceGroup, NamespaceName, queueAttributes.Name, queueAttributes)); } }
public void SetAttributesTest() { Queue queue = client.GetNativeQueue("UTQueue"); var resp = queue.GetAttributes(); var originalLoggingEnabled = resp.Attributes.LoggingEnabled; QueueAttributes qa = new QueueAttributes(); queue.SetAttributes(qa); resp = queue.GetAttributes(); Assert.AreEqual(originalLoggingEnabled, resp.Attributes.LoggingEnabled); qa = new QueueAttributes() { LoggingEnabled = false }; queue.SetAttributes(qa); resp = queue.GetAttributes(); Assert.AreEqual(false, resp.Attributes.LoggingEnabled); qa = new QueueAttributes(); queue.SetAttributes(qa); resp = queue.GetAttributes(); Assert.AreEqual(false, resp.Attributes.LoggingEnabled); qa = new QueueAttributes() { LoggingEnabled = true }; queue.SetAttributes(qa); resp = queue.GetAttributes(); Assert.AreEqual(true, resp.Attributes.LoggingEnabled); qa = new QueueAttributes(); queue.SetAttributes(qa); resp = queue.GetAttributes(); Assert.AreEqual(true, resp.Attributes.LoggingEnabled); qa = new QueueAttributes() { LoggingEnabled = true }; var req = new CreateQueueRequest() { QueueName = "UTQueue2", Attributes = qa }; Queue queue2 = client.CreateQueue(req); resp = queue2.GetAttributes(); Assert.AreEqual(true, resp.Attributes.LoggingEnabled); client.DeleteQueue("UTQueue2"); qa = new QueueAttributes() { LoggingEnabled = false }; req = new CreateQueueRequest() { QueueName = "UTQueue2", Attributes = qa }; queue2 = client.CreateQueue(req); resp = queue2.GetAttributes(); Assert.AreEqual(false, resp.Attributes.LoggingEnabled); }
/// <summary> /// Instantiates CreateQueueRequest with the parameterized properties /// </summary> /// <param name="queueName">The name for the queue to be created.</param> /// <param name="attributes">The queue attributes to be set.</param> public CreateQueueRequest(string queueName, QueueAttributes attributes) { _queueName = queueName; _attributes = attributes; }
/// <summary> /// Initializes a new instance of the <see cref="QueueEntry"/> class. /// </summary> /// <param name="name">The name of the queue.</param> /// <param name="attributes">The queue's attributes.</param> internal QueueEntry(string name, QueueAttributes attributes) { this.Name = name; this.Attributes = attributes; }
/// <summary> /// Instantiates SetQueueAttributesRequest with the parameterized properties /// </summary> /// <param name="attributes">The queue attributes to set.</param> public SetQueueAttributesRequest(QueueAttributes attributes) { _attributes = attributes; }
public override void ExecuteCmdlet() { QueueAttributes queueAttributes = new QueueAttributes(); NamespaceAttributes getNamespaceLoc = Client.GetNamespace(ResourceGroupName, Namespace); queueAttributes.Name = Name; queueAttributes.EnablePartitioning = EnablePartitioning; if (LockDuration != null) { queueAttributes.LockDuration = LockDuration; } if (AutoDeleteOnIdle != null) { queueAttributes.AutoDeleteOnIdle = AutoDeleteOnIdle; } if (DefaultMessageTimeToLive != null) { queueAttributes.DefaultMessageTimeToLive = DefaultMessageTimeToLive; } if (DuplicateDetectionHistoryTimeWindow != null) { queueAttributes.DuplicateDetectionHistoryTimeWindow = DuplicateDetectionHistoryTimeWindow; } if (DeadLetteringOnMessageExpiration != null) { queueAttributes.DeadLetteringOnMessageExpiration = DeadLetteringOnMessageExpiration; } if (MaxSizeInMegabytes != null) { queueAttributes.MaxSizeInMegabytes = (int?)MaxSizeInMegabytes; } if (MaxDeliveryCount != null) { queueAttributes.MaxDeliveryCount = MaxDeliveryCount; } if (MessageCount != null) { queueAttributes.MessageCount = MessageCount; } if (RequiresDuplicateDetection != null) { queueAttributes.RequiresDuplicateDetection = RequiresDuplicateDetection; } if (RequiresSession != null) { queueAttributes.RequiresSession = RequiresSession; } if (SizeInBytes != null) { queueAttributes.SizeInBytes = SizeInBytes; } if (ShouldProcess(target: Name, action: string.Format(Resources.CreateQueue, Name, Namespace))) { WriteObject(Client.CreateUpdateQueue(ResourceGroupName, Namespace, Name, queueAttributes)); } }
public QueueAttributes CreateUpdateQueue(string resourceGroupName, string namespaceName, string queueName, QueueAttributes queue) { SBQueue parameters = new SBQueue(); if (queue.LockDuration != null) { parameters.LockDuration = (TimeSpan?)AzureServiceBusCmdletBase.ParseTimespan(queue.LockDuration); } if (queue.AutoDeleteOnIdle != null) { parameters.AutoDeleteOnIdle = (TimeSpan?)AzureServiceBusCmdletBase.ParseTimespan(queue.AutoDeleteOnIdle); } if (queue.DefaultMessageTimeToLive != null) { parameters.DefaultMessageTimeToLive = (TimeSpan?)AzureServiceBusCmdletBase.ParseTimespan(queue.DefaultMessageTimeToLive); } if (queue.DuplicateDetectionHistoryTimeWindow != null) { parameters.DuplicateDetectionHistoryTimeWindow = (TimeSpan?)AzureServiceBusCmdletBase.ParseTimespan(queue.DuplicateDetectionHistoryTimeWindow); } if (queue.DeadLetteringOnMessageExpiration.HasValue) { parameters.DeadLetteringOnMessageExpiration = queue.DeadLetteringOnMessageExpiration; } if (queue.EnableExpress.HasValue) { parameters.EnableExpress = queue.EnableExpress; } if (queue.EnablePartitioning.HasValue) { parameters.EnablePartitioning = queue.EnablePartitioning; } if (queue.MaxDeliveryCount.HasValue) { parameters.MaxDeliveryCount = queue.MaxDeliveryCount; } if (queue.MaxSizeInMegabytes.HasValue) { parameters.MaxSizeInMegabytes = queue.MaxSizeInMegabytes; } if (queue.RequiresDuplicateDetection.HasValue) { parameters.RequiresDuplicateDetection = queue.RequiresDuplicateDetection; } if (queue.RequiresSession.HasValue) { parameters.RequiresSession = queue.RequiresSession; } if (queue.Status.HasValue) { parameters.Status = queue.Status; } SBQueue response = Client.Queues.CreateOrUpdate(resourceGroupName, namespaceName, queueName, parameters); return(new QueueAttributes(response)); }
public QueueAttributes CreateUpdateQueue(string resourceGroupName, string namespaceName, string queueName, QueueAttributes queue) { QueueCreateOrUpdateParameters parameters = new QueueCreateOrUpdateParameters() { Name = queue.Name, Location = queue.Location, LockDuration = queue.LockDuration, AutoDeleteOnIdle = queue.AutoDeleteOnIdle, EntityAvailabilityStatus = queue.EntityAvailabilityStatus, DefaultMessageTimeToLive = queue.DefaultMessageTimeToLive, DuplicateDetectionHistoryTimeWindow = queue.DuplicateDetectionHistoryTimeWindow, EnableBatchedOperations = queue.EnableBatchedOperations, DeadLetteringOnMessageExpiration = queue.DeadLetteringOnMessageExpiration, EnableExpress = queue.EnableExpress, EnablePartitioning = queue.EnablePartitioning, IsAnonymousAccessible = queue.IsAnonymousAccessible, MaxDeliveryCount = queue.MaxDeliveryCount, MaxSizeInMegabytes = queue.MaxSizeInMegabytes, RequiresDuplicateDetection = queue.RequiresDuplicateDetection, RequiresSession = queue.RequiresSession, Status = queue.Status, SupportOrdering = queue.SupportOrdering, }; QueueResource response = Client.Queues.CreateOrUpdate(resourceGroupName, namespaceName, queueName, parameters); return(new QueueAttributes(response)); }
public override WebServiceResponse Unmarshall(XmlUnmarshallerContext context) { XmlTextReader reader = new XmlTextReader(context.ResponseStream); QueueAttributes attributes = new QueueAttributes(); while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: switch (reader.LocalName) { case MNSConstants.XML_ELEMENT_QUEUE_NAME: reader.Read(); attributes.QueueName = reader.Value; break; case MNSConstants.XML_ELEMENT_CREATE_TIME: reader.Read(); attributes.CreateTime = AliyunSDKUtils.ConvertFromUnixEpochSeconds(long.Parse(reader.Value) * 1000); break; case MNSConstants.XML_ELEMENT_LAST_MODIFY_TIME: reader.Read(); attributes.LastModifyTime = AliyunSDKUtils.ConvertFromUnixEpochSeconds(long.Parse(reader.Value) * 1000); break; case MNSConstants.XML_ELEMENT_VISIBILITY_TIMEOUT: reader.Read(); attributes.VisibilityTimeout = uint.Parse(reader.Value); break; case MNSConstants.XML_ELEMENT_MAXIMUM_MESSAGE_SIZE: reader.Read(); attributes.MaximumMessageSize = uint.Parse(reader.Value); break; case MNSConstants.XML_ELEMENT_MESSAGE_RETENTION_PERIOD: reader.Read(); attributes.MessageRetentionPeriod = uint.Parse(reader.Value); break; case MNSConstants.XML_ELEMENT_DELAY_SECONDS: reader.Read(); attributes.DelaySeconds = uint.Parse(reader.Value); break; case MNSConstants.XML_ELEMENT_POLLING_WAIT_SECONDS: reader.Read(); attributes.PollingWaitSeconds = uint.Parse(reader.Value); break; case MNSConstants.XML_ELEMENT_INACTIVE_MESSAGES: reader.Read(); attributes.InactiveMessages = uint.Parse(reader.Value); break; case MNSConstants.XML_ELEMENT_ACTIVE_MESSAGES: reader.Read(); attributes.ActiveMessages = uint.Parse(reader.Value); break; case MNSConstants.ATTRIBUTE_DELAY_MESSAGES: reader.Read(); attributes.DelayMessages = uint.Parse(reader.Value); break; case MNSConstants.XML_ELEMENT_LOGGING_ENABLED: reader.Read(); attributes.LoggingEnabled = bool.Parse(reader.Value); break; } break; } } reader.Close(); return(new GetQueueAttributesResponse() { Attributes = attributes }); }