Ejemplo n.º 1
0
        /// <summary>
        /// Calculates the endpoint based on the calling format.
        /// </summary>
        internal static string buildUrlBase(string server, int port, string bucket, CallingFormat format)
        {
            StringBuilder endpoint = new StringBuilder();

            if (format == CallingFormat.REGULAR)
            {
                endpoint.Append(server);
                endpoint.Append(":");
                endpoint.Append(port);
                if (bucket != null && !bucket.Equals(""))
                {
                    endpoint.Append("/");
                    endpoint.Append(bucket);
                }
            }
            else if (format == CallingFormat.SUBDOMAIN)
            {
                if (bucket.Length != 0)
                {
                    endpoint.Append(bucket);
                    endpoint.Append(".");
                }
                endpoint.Append(server);
                endpoint.Append(":");
                endpoint.Append(port);
            }
            else if (format == CallingFormat.VANITY)
            {
                endpoint.Append(bucket);
                endpoint.Append(":");
                endpoint.Append(port);
            }
            endpoint.Append("/");
            return(endpoint.ToString());
        }
Ejemplo n.º 2
0
 public QueryStringAuthGenerator(
     string awsAccessKeyId,
     string awsSecretAccessKey,
     bool isSecure,
     CallingFormat format)
     : this(awsAccessKeyId, awsSecretAccessKey, isSecure, Utils.Host, format)
 {
 }
Ejemplo n.º 3
0
 public AWSAuthConnection(
     string awsAccessKeyId,
     string awsSecretAccessKey,
     bool isSecure,
     string server,
     CallingFormat format)
     : this(awsAccessKeyId, awsSecretAccessKey, isSecure, server, pickPort(isSecure), format)
 {
 }
Ejemplo n.º 4
0
 public AWSAuthConnection( string awsAccessKeyId, string awsSecretAccessKey, bool isSecure,
                           string server, int port, CallingFormat format )
 {
     this.awsAccessKeyId = awsAccessKeyId;
     this.awsSecretAccessKey = awsSecretAccessKey;
     this.isSecure = isSecure;
     this.server = server;
     this.port = port;
     this.callingFormat = format;
 }
Ejemplo n.º 5
0
 public Connection(string awsAccessKeyId, string awsSecretAccessKey, bool isSecure,
                   string server, int port, CallingFormat format)
 {
     this.awsAccessKeyId     = awsAccessKeyId;
     this.awsSecretAccessKey = awsSecretAccessKey;
     this.isSecure           = isSecure;
     this.server             = server;
     this.port          = port;
     this.callingFormat = format;
 }
Ejemplo n.º 6
0
 public QueryStringAuthGenerator(string awsAccessKeyId, string awsSecretAccessKey,
                              bool isSecure, string server, int port, CallingFormat format) {
     this.awsAccessKeyId = awsAccessKeyId;
     this.awsSecretAccessKey = awsSecretAccessKey;
     this.isSecure = isSecure;
     this.server = server;
     this.port = port;
     this.expiresIn = DEFAULT_EXPIRES_IN;
     this.expires = NOT_SET;
     this.callingFormat = format;
 }
Ejemplo n.º 7
0
 public QueryStringAuthGenerator(
     string awsAccessKeyId,
     string awsSecretAccessKey,
     bool isSecure,
     string server,
     CallingFormat format)
     : this(awsAccessKeyId,
            awsSecretAccessKey,
            isSecure,
            server,
            isSecure ? Utils.SecurePort : Utils.InsecurePort,
            format)
 {
 }
 private ConnectionBase GetConnection()
 {
     string server = (string)null;
     CallingFormat format = CallingFormat.REGULAR;
     if (!string.IsNullOrEmpty(this._s3domain))
     {
         server = this._s3domain;
         format = CallingFormat.VANITY;
     }
     else if (!string.IsNullOrEmpty(this._region))
         server = "s3-" + this._region + ".amazonaws.com";
     if (this._authorization == "AWS4-HMAC-SHA256")
         return new V4Connection(this._awsAuthPublicKey, this._awsAuthPrivateKey, this._isSecure, server, format, this._region, "s3");
     return new AwsConnection(this._awsAuthPublicKey, this._awsAuthPrivateKey, this._isSecure, server, format, this._region);
 }
Ejemplo n.º 9
0
 public QueryStringAuthGenerator(
     string awsAccessKeyId,
     string awsSecretAccessKey,
     bool isSecure,
     string server,
     int port,
     CallingFormat format
     )
 {
     this.awsAccessKeyId     = awsAccessKeyId;
     this.awsSecretAccessKey = awsSecretAccessKey;
     this.isSecure           = isSecure;
     this.server             = server;
     this.port     = port;
     expiresIn     = DEFAULT_EXPIRES_IN;
     expires       = NOT_SET;
     callingFormat = format;
 }
Ejemplo n.º 10
0
 public AWSAuthConnection(string awsAccessKeyId, string awsSecretAccessKey, bool isSecure, CallingFormat format) :
     this( awsAccessKeyId, awsSecretAccessKey, isSecure, Utils.Host, format )
 {
 }
Ejemplo n.º 11
0
 public AWSAuthConnection(string awsAccessKeyId, string awsSecretAccessKey, CallingFormat format )
     :
     this(awsAccessKeyId, awsSecretAccessKey, true, format )
 {
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Calculates the endpoint based on the calling format.
        /// </summary>
        public static string buildUrlBase( string server, int port, string bucket, CallingFormat format )
        {
            StringBuilder endpoint = new StringBuilder();

            if ( format == CallingFormat.REGULAR )
            {
                endpoint.Append( server );
                endpoint.Append( ":" );
                endpoint.Append( port );
                if ( bucket != null && ! bucket.Equals( "" ) )
                {
                    endpoint.Append( "/" );
                    endpoint.Append( bucket );
                }
            }
            else if ( format == CallingFormat.SUBDOMAIN )
            {
                if ( bucket.Length != 0 ) {
                    endpoint.Append( bucket );
                    endpoint.Append( "." );
                }
                endpoint.Append( server );
                endpoint.Append( ":" );
                endpoint.Append( port );
            }
            else if ( format == CallingFormat.VANITY )
            {
                endpoint.Append( bucket );
                endpoint.Append( ":" );
                endpoint.Append( port );
            }
            endpoint.Append( "/" );
            return endpoint.ToString();
        }
 public QueryStringAuthGenerator(string awsAccessKeyId, string awsSecretAccessKey,
                                  bool isSecure, string server, CallingFormat format )
     : this(awsAccessKeyId, awsSecretAccessKey, isSecure, server,
            isSecure ? Utils.SecurePort : Utils.InsecurePort, format)
 {
 }
 public QueryStringAuthGenerator( string awsAccessKeyId, string awsSecretAccessKey,
                                  bool isSecure, CallingFormat format )
     : this(awsAccessKeyId, awsSecretAccessKey, isSecure, Utils.Host, format)
 {
 }
Ejemplo n.º 15
0
 public Connection(string awsAccessKeyId, string awsSecretAccessKey, bool isSecure, CallingFormat format) :
     this(awsAccessKeyId, awsSecretAccessKey, isSecure, Utils.Host, format)
 {
 }
Ejemplo n.º 16
0
 public V4Connection(string awsAccessKeyId, string secretKey, bool isSecure, string server, CallingFormat format, string region, string service)
     : base(awsAccessKeyId, secretKey, isSecure, server, CallingFormat.SUBDOMAIN, region)
 {
     if (string.IsNullOrEmpty(region))
     {
         throw new ArgumentException("You must configure region for using AWS4 configuration");
     }
     this.service = service;
 }
Ejemplo n.º 17
0
 public Connection(string awsAccessKeyId, string awsSecretAccessKey, bool isSecure,
                   string server, CallingFormat format) :
     this(awsAccessKeyId, awsSecretAccessKey, isSecure, server,
          isSecure ? Utils.SecurePort : Utils.InsecurePort, format)
 {
 }
Ejemplo n.º 18
0
 public AWSAuthConnection( string awsAccessKeyId, string awsSecretAccessKey, bool isSecure,
                           string server, CallingFormat format ) :
     this(awsAccessKeyId, awsSecretAccessKey, isSecure, server,
           isSecure ? Utils.SecurePort : Utils.InsecurePort, format )
 {
 }
Ejemplo n.º 19
0
        internal static string buildUrlBase(bool isSecure, string server, int port, string bucket, CallingFormat format)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(isSecure ? "https://" : "http://");
            if (format == CallingFormat.REGULAR)
            {
                stringBuilder.Append(server);
                stringBuilder.Append(":");
                stringBuilder.Append(port);
                if (bucket != null && !bucket.Equals(""))
                {
                    stringBuilder.Append("/");
                    stringBuilder.Append(bucket);
                }
            }
            else if (format == CallingFormat.SUBDOMAIN)
            {
                if (bucket.Length != 0)
                {
                    stringBuilder.Append(bucket);
                    stringBuilder.Append(".");
                }
                stringBuilder.Append(server);
                stringBuilder.Append(":");
                stringBuilder.Append(port);
            }
            else if (format == CallingFormat.VANITY)
            {
                stringBuilder.Append(bucket);
                stringBuilder.Append(":");
                stringBuilder.Append(port);
            }
            stringBuilder.Append("/");
            return(stringBuilder.ToString());
        }
Ejemplo n.º 20
0
 public AwsConnection(string awsAccessKeyId, string awsSecretAccessKey, bool isSecure, string server, int port, CallingFormat format, string region)
     : base(awsAccessKeyId, awsSecretAccessKey, isSecure, server, format, region)
 {
 }
Ejemplo n.º 21
0
 public Connection(string awsAccessKeyId, string awsSecretAccessKey, CallingFormat format)
     :
     this(awsAccessKeyId, awsSecretAccessKey, true, format)
 {
 }