/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
using System;
using Amazon.SQS.Util;
using Amazon.Util;
namespace Amazon.SQS.Model
{
///
/// Get Queue Attributes Result
///
public partial class GetQueueAttributesResponse
{
///
/// Gets the visibility timeout from the Attributes collection.
///
public int VisibilityTimeout
{
get
{
int value;
if (!int.TryParse(getAttributeValue(SQSConstants.ATTRIBUTE_VISIBILITY_TIMEOUT), out value))
value = 0;
return value;
}
}
///
/// Gets the delay in seconds from the Attributes collection.
///
public int DelaySeconds
{
get
{
int value;
if (!int.TryParse(getAttributeValue(SQSConstants.ATTRIBUTE_DELAY_SECONDS), out value))
value = 0;
return value;
}
}
///
/// Gets the maximum message size from the Attributes collection.
///
public int MaximumMessageSize
{
get
{
int value;
if (!int.TryParse(getAttributeValue(SQSConstants.ATTRIBUTE_MAXIMUM_MESSAGE_SIZE), out value))
value = 0;
return value;
}
}
///
/// Returns the message retention period from the Attributes collection.
///
public int MessageRetentionPeriod
{
get
{
int value;
if (!int.TryParse(getAttributeValue(SQSConstants.ATTRIBUTE_MESSAGE_RETENTION_PERIOD), out value))
value = 0;
return value;
}
}
///
/// Gets the approximate number of messages from the Attributes collection.
///
public int ApproximateNumberOfMessages
{
get
{
int value;
if (!int.TryParse(getAttributeValue(SQSConstants.ATTRIBUTE_APPROXIMATE_NUMBER_OF_MESSAGES), out value))
value = 0;
return value;
}
}
///
/// Gets the approximate number of messages not visible from the Attributes collection.
///
public int ApproximateNumberOfMessagesNotVisible
{
get
{
int value;
if (!int.TryParse(getAttributeValue(SQSConstants.ATTRIBUTE_APPROXIMATE_NUMBER_OF_MESSAGES_NOT_VISIBLE), out value))
value = 0;
return value;
}
}
///
/// Gets the approximate number of messages delayed from the Attributes collection.
///
public int ApproximateNumberOfMessagesDelayed
{
get
{
int value;
if (!int.TryParse(getAttributeValue(SQSConstants.ATTRIBUTE_APPROXIMATE_NUMBER_OF_MESSAGES_DELAYED), out value))
value = 0;
return value;
}
}
///
/// Gets the created timestamp from the Attributes collection.
///
public DateTime CreatedTimestamp
{
get
{
int value;
if (!int.TryParse(getAttributeValue(SQSConstants.ATTRIBUTE_CREATED_TIMESTAMP), out value))
value = 0;
return AWSSDKUtils.ConvertFromUnixEpochSeconds(value);
}
}
///
/// Gets the last modified timestamp from the Attributes collection.
///
public DateTime LastModifiedTimestamp
{
get
{
int value;
if (!int.TryParse(getAttributeValue(SQSConstants.ATTRIBUTE_LAST_MODIFIED_TIMESTAMP), out value))
value = 0;
return AWSSDKUtils.ConvertFromUnixEpochSeconds(value);
}
}
///
/// Gets the queue arn from the Attributes collection.
///
public string QueueARN
{
get
{
return getAttributeValue(SQSConstants.ATTRIBUTE_QUEUE_ARN);
}
}
///
/// Gets the queue access policy from the Attributes collection.
///
public string Policy
{
get
{
return getAttributeValue(SQSConstants.ATTRIBUTE_POLICY);
}
}
///
/// Whether or not the queue is a First-In-First-Out (FIFO) queue
///
public bool FifoQueue
{
get
{
var attributeValue = getAttributeValue(SQSConstants.ATTRIBUTE_FIFO_QUEUE);
bool result;
if (bool.TryParse(attributeValue, out result))
return result;
return false;
}
}
///
/// Whether or not the First-In-First-Out (FIFO) queue has content based deduplication enabled. For non-FIFO queues this will return null.
///
public bool? ContentBasedDeduplication
{
get
{
var attributeValue = getAttributeValue(SQSConstants.ATTRIBUTE_CONTENT_BASED_DEDUPLICATION);
bool result;
if (bool.TryParse(attributeValue, out result))
return result;
return null;
}
}
private string getAttributeValue(string field)
{
string value = null;
this.Attributes.TryGetValue(field, out value);
return value;
}
}
}