Configuration for accessing Amazon Glacier service
Inheritance: Amazon.Runtime.ClientConfig
Example #1
0
        public FDGlacier(FDUserSettings settings, FDOperationLog oplog, string optype)
        {
            this.vaultName = settings.AWSGlacierVaultName;
            log = oplog;

            switch (settings.AWSRegion) {
            case FDUserSettings.AWSRegionIndex.USWest1:
                region = RegionEndpoint.USWest1;
                break;
            case FDUserSettings.AWSRegionIndex.USWest2:
                region = RegionEndpoint.USWest2;
                break;
            case FDUserSettings.AWSRegionIndex.USEast1:
                region = RegionEndpoint.USEast1;
                break;
            case FDUserSettings.AWSRegionIndex.EUWest1:
                region = RegionEndpoint.EUWest1;
                break;
            case FDUserSettings.AWSRegionIndex.APNortheast1:
                region = RegionEndpoint.APNortheast1;
                break;
            default:
                region = RegionEndpoint.USEast1;
                break;
            }

            //Instantiate the glacier config with our settins (for future move to AmazonGlacierClient)
            glacierConfig = new AmazonGlacierConfig();
            glacierConfig.RegionEndpoint = region;

            //Instantiate AWS Credentials
            awsCredentials = new BasicAWSCredentials(settings.AWSAccessKey, settings.AWSSecretKey);

            //Instantiate the transfer manager with our settings
            //TODO: Switch to glacier client so we can abort this damn thing
            //glacierClient = new AmazonGlacierClient(appConfig["AWSAccessKey"], appConfig["AWSSecretKey"], region);
            transferManager = new ArchiveTransferManager(awsCredentials, region);

            upOptions = new UploadOptions();
            downOptions = new DownloadOptions();
            progress = 0;
            upOptions.StreamTransferProgress = downOptions.StreamTransferProgress = this.onProgress;

            OperationType = optype;
        }
Example #2
0
 /// <summary>
 /// Constructs AmazonGlacierClient with AWS Access Key ID, AWS Secret Key and an
 /// AmazonGlacierClient Configuration object. 
 /// </summary>
 /// <param name="awsAccessKeyId">AWS Access Key ID</param>
 /// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
 /// <param name="awsSessionToken">AWS Session Token</param>
 /// <param name="clientConfig">The AmazonGlacierClient Configuration Object</param>
 public AmazonGlacierClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonGlacierConfig clientConfig)
     : base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig)
 {
 }
Example #3
0
 /// <summary>
 /// Constructs AmazonGlacierClient with AWS Credentials and an
 /// AmazonGlacierClient Configuration object.
 /// </summary>
 /// <param name="credentials">AWS Credentials</param>
 /// <param name="clientConfig">The AmazonGlacierClient Configuration Object</param>
 public AmazonGlacierClient(AWSCredentials credentials, AmazonGlacierConfig clientConfig)
     : base(credentials, clientConfig)
 {
 }
Example #4
0
 /// <summary>
 /// Constructs AmazonGlacierClient with the credentials loaded from the application's
 /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
 /// 
 /// Example App.config with credentials set. 
 /// <code>
 /// &lt;?xml version="1.0" encoding="utf-8" ?&gt;
 /// &lt;configuration&gt;
 ///     &lt;appSettings&gt;
 ///         &lt;add key="AWSProfileName" value="AWS Default"/&gt;
 ///     &lt;/appSettings&gt;
 /// &lt;/configuration&gt;
 /// </code>
 ///
 /// </summary>
 /// <param name="config">The AmazonGlacierClient Configuration Object</param>
 public AmazonGlacierClient(AmazonGlacierConfig config)
     : base(FallbackCredentialsFactory.GetCredentials(), config) { }
 /// <summary>
 /// Constructs AmazonGlacierClient with AWS Access Key ID, AWS Secret Key and an
 /// AmazonGlacierClient Configuration object. If the config object's
 /// UseSecureStringForAwsSecretKey is false, the AWS Secret Key
 /// is stored as a clear-text string. Please use this option only
 /// if the application environment doesn't allow the use of SecureStrings.
 /// </summary>
 /// <param name="awsAccessKeyId">AWS Access Key ID</param>
 /// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
 /// <param name="awsSessionToken">AWS Session Token</param>
 /// <param name="clientConfig">The AmazonGlacierClient Configuration Object</param>
 public AmazonGlacierClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonGlacierConfig clientConfig)
     : base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig, AuthenticationTypes.User | AuthenticationTypes.Session)
 {
 }
 /// <summary>
 /// Constructs AmazonGlacierClient with AWS Credentials and an
 /// AmazonGlacierClient Configuration object.
 /// </summary>
 /// <param name="credentials">AWS Credentials</param>
 /// <param name="clientConfig">The AmazonGlacierClient Configuration Object</param>
 public AmazonGlacierClient(AWSCredentials credentials, AmazonGlacierConfig clientConfig)
     : base(credentials, clientConfig, AuthenticationTypes.User | AuthenticationTypes.Session)
 {
 }
 /// <summary>
 /// Constructs AmazonGlacierClient with the credentials loaded from the application's
 /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
 /// 
 /// Example App.config with credentials set. 
 /// <code>
 /// &lt;?xml version="1.0" encoding="utf-8" ?&gt;
 /// &lt;configuration&gt;
 ///     &lt;appSettings&gt;
 ///         &lt;add key="AWSAccessKey" value="********************"/&gt;
 ///         &lt;add key="AWSSecretKey" value="****************************************"/&gt;
 ///     &lt;/appSettings&gt;
 /// &lt;/configuration&gt;
 /// </code>
 ///
 /// </summary>
 /// <param name="config">The AmazonGlacier Configuration Object</param>
 public AmazonGlacierClient(AmazonGlacierConfig config)
     : base(FallbackCredentialsFactory.GetCredentials(), config, AuthenticationTypes.User | AuthenticationTypes.Session) { }
        private OperationResult EstablishClient(AddonManifest manifest, DeveloperOptions devOptions, out AmazonGlacierClient client)
        {
            OperationResult result;

            bool requireCreds;
            //var accessKey = manifest.ProvisioningUsername;
            //var secretAccessKey = manifest.ProvisioningPassword;
            var accessKey = devOptions.AccessKey;
            var secretAccessKey = devOptions.SecretAccessKey;

            var prop =
                manifest.Properties.First(
                    p => p.Key.Equals("requireDevCredentials", StringComparison.InvariantCultureIgnoreCase));

            if (bool.TryParse(prop.Value, out requireCreds) && requireCreds)
            {
                if (!ValidateDevCreds(devOptions))
                {
                    client = null;
                    result = new OperationResult()
                    {
                        IsSuccess = false,
                        EndUserMessage =
                            "The add on requires that developer credentials are specified but none were provided."
                    };
                    return result;
                }

                accessKey = devOptions.AccessKey;
                secretAccessKey = devOptions.SecretAccessKey;
            }

            AmazonGlacierConfig config = new AmazonGlacierConfig() { RegionEndpoint = RegionEndpoint.USEast1 };
            client = new AmazonGlacierClient(devOptions.AccessKey, devOptions.SecretAccessKey, config);
            result = new OperationResult { IsSuccess = true };
            return result;
        }
 /// <summary>
 /// Create a client for the Amazon Glacier Service with AWSCredentials and an AmazonGlacier Configuration object.
 /// </summary>
 /// <param name="credentials">AWS Credentials</param>
 /// <param name="config">Configuration options for the service like HTTP Proxy, # of connections, etc</param>
 /// <returns>An Amazon Glacier client</returns>
 /// <remarks>
 /// </remarks>
 public static IAmazonGlacier CreateAmazonGlacierClient(AWSCredentials credentials, AmazonGlacierConfig config)
 {
     return new AmazonGlacierClient(credentials, config);
 }
 /// <summary>
 /// Create a client for the Amazon Glacier Service with the specified configuration
 /// </summary>
 /// <param name="awsAccessKey">The AWS Access Key associated with the account</param>
 /// <param name="awsSecretAccessKey">The AWS Secret Access Key associated with the account</param>
 /// <param name="config">Configuration options for the service like HTTP Proxy, # of connections, etc
 /// </param>
 /// <returns>An Amazon Glacier client</returns>
 /// <remarks>
 /// </remarks>
 public static IAmazonGlacier CreateAmazonGlacierClient(
     string awsAccessKey,
     string awsSecretAccessKey, AmazonGlacierConfig config
     )
 {
     return new AmazonGlacierClient(awsAccessKey, awsSecretAccessKey, config);
 }
 /// <summary>
 /// Create a client for the Amazon Glacier Service with the credentials loaded from the application's
 /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
 /// 
 /// Example App.config with credentials set. 
 /// <code>
 /// &lt;?xml version="1.0" encoding="utf-8" ?&gt;
 /// &lt;configuration&gt;
 ///     &lt;appSettings&gt;
 ///         &lt;add key="AWSAccessKey" value="********************"/&gt;
 ///         &lt;add key="AWSSecretKey" value="****************************************"/&gt;
 ///     &lt;/appSettings&gt;
 /// &lt;/configuration&gt;
 /// </code>
 /// </summary>
 /// <param name="config">Configuration options for the service like HTTP Proxy, # of connections, etc</param>
 /// <returns>An Amazon Glacier client</returns>
 public static IAmazonGlacier CreateAmazonGlacierClient(AmazonGlacierConfig config)
 {
     return new AmazonGlacierClient(config);
 }
Example #12
0
 /// <summary>
 /// Constructs AmazonGlacierClient with AWS Access Key ID, AWS Secret Key and an
 /// AmazonGlacierClient Configuration object.
 /// </summary>
 /// <param name="awsAccessKeyId">AWS Access Key ID</param>
 /// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
 /// <param name="awsSessionToken">AWS Session Token</param>
 /// <param name="clientConfig">The AmazonGlacierClient Configuration Object</param>
 public AmazonGlacierClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonGlacierConfig clientConfig)
     : base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig)
 {
 }
Example #13
0
 /// <summary>
 /// Constructs AmazonGlacierClient with AWS Credentials and an
 /// AmazonGlacierClient Configuration object.
 /// </summary>
 /// <param name="credentials">AWS Credentials</param>
 /// <param name="clientConfig">The AmazonGlacierClient Configuration Object</param>
 public AmazonGlacierClient(AWSCredentials credentials, AmazonGlacierConfig clientConfig)
     : base(credentials, clientConfig)
 {
 }