/* * 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 System.Collections.Generic; using System.Linq; using System.Text; using Amazon.Glacier.Model; using System.Globalization; namespace Amazon.Glacier { /// /// Extension methods for Amazon Glacier. /// public static class AmazonGlacierExtensions { /// /// Creates the range formatted string and set the Range property. /// /// /// The start of the range. /// The end of the range. This can be null which would return the data to the end. public static void SetRange(this GetJobOutputRequest request, long start, long? end) { string range; if (end == null) range = string.Format(CultureInfo.InvariantCulture, "bytes={0}-", start); else range = string.Format(CultureInfo.InvariantCulture, "bytes={0}-{1}", start, end.Value); request.Range = range; } /// /// Creates the range formatted string and set the Range property. /// /// /// The start of the range. /// The end of the range. public static void SetRange(this UploadMultipartPartRequest request, long start, long end) { request.Range = string.Format(CultureInfo.InvariantCulture, "bytes {0}-{1}/*", start, end); } } }