Наследование: System.EventArgs
Пример #1
0
 internal void FireBeforeRequestEvent(object sender, RequestEventArgs args)
 {
     if (mBeforeRequestEvent != null)
     {
         mBeforeRequestEvent(sender, args);
     }
 }
Пример #2
0
        private void ClientBeforeRequestEvent(object sender, Amazon.Runtime.RequestEventArgs e)
        {
            var client = sender as AmazonServiceClient;

            if (client == null)
            {
                throw new InvalidOperationException();
            }

            var wsrea = e as WebServiceRequestEventArgs;

            if (wsrea == null)
            {
                throw new InvalidOperationException();
            }

            var request = wsrea.Request;

            var describeTableRequest = request as DescribeTableRequest;

            if (describeTableRequest != null)
            {
                var keys = TableCache.Keys;
                if (keys.Contains(describeTableRequest.TableName))
                {
                    Assert.True(false, "Attempting to describe table that has already been described");
                }
            }
        }
Пример #3
0
 internal static void FileIORequestEventHandler(object sender, RequestEventArgs args)
 {
     WebServiceRequestEventArgs wsArgs = args as WebServiceRequestEventArgs;
     if (wsArgs != null)
     {
         string currentUserAgent = wsArgs.Headers[AWSSDKUtils.UserAgentHeader];
         wsArgs.Headers[AWSSDKUtils.UserAgentHeader] = currentUserAgent + " FileIO";
     }
 }
Пример #4
0
 internal static void FileIORequestEventHandler(object sender, RequestEventArgs args)
 {
     S3RequestEventArgs s3args = args as S3RequestEventArgs;
     if (s3args != null)
     {
         string currentUserAgent = s3args.Headers[System.Net.HttpRequestHeader.UserAgent];
         s3args.Headers[System.Net.HttpRequestHeader.UserAgent] =
             currentUserAgent + " FileIO";
     }
 }
Пример #5
0
 protected void RequestEventHandler(object sender, RequestEventArgs args)
 {
     S3RequestEventArgs s3args = args as S3RequestEventArgs;
     if (s3args != null)
     {
         string currentUserAgent = s3args.Headers[System.Net.HttpRequestHeader.UserAgent];
         s3args.Headers[System.Net.HttpRequestHeader.UserAgent] =
             currentUserAgent + " TransferManager/" + this.GetType().Name;
     }
 }
Пример #6
0
 protected void RequestEventHandler(object sender, RequestEventArgs args)
 {
     WebServiceRequestEventArgs wsArgs = args as WebServiceRequestEventArgs;
     if (wsArgs != null)
     {
         string currentUserAgent = wsArgs.Headers[AWSSDKUtils.UserAgentHeader];
         wsArgs.Headers[AWSSDKUtils.UserAgentHeader] =
             currentUserAgent + " TransferManager/" + this.GetType().Name;
     }
 }
Пример #7
0
 private void UserAgentRequestEventHandler(object sender, RequestEventArgs args, bool isAsync)
 {
     WebServiceRequestEventArgs wsArgs = args as WebServiceRequestEventArgs;
     if (wsArgs != null)
     {
         string currentUserAgent = wsArgs.Headers[AWSSDKUtils.UserAgentHeader];
         wsArgs.Headers[AWSSDKUtils.UserAgentHeader] =
             currentUserAgent + " " + this.TableConsumer.ToString() + " " + (isAsync ? "TableAsync" : "TableSync");
     }
 }
Пример #8
0
 internal void UserAgentRequestEventHandlerSync(object sender, RequestEventArgs args)
 {
     UserAgentRequestEventHandler(sender, args, false);
 }
Пример #9
0
 internal void FireBeforeRequestEvent(object sender, RequestEventArgs args)
 {
     if (BeforeRequestEvent != null)
         BeforeRequestEvent(sender, args);
 }
Пример #10
0
 void Amazon.S3.Internal.IS3RequestEvents.FireBeforeRequestEvent(object sender, RequestEventArgs args)
 {
     ((S3Request)this).FireBeforeRequestEvent(sender, args);
 }
Пример #11
0
 internal void UserAgentRequestEventHandler(object sender, RequestEventArgs args)
 {
     WebServiceRequestEventArgs wsArgs = args as WebServiceRequestEventArgs;
     if (wsArgs != null)
     {
         string currentUserAgent = wsArgs.Headers[AWSSDKUtils.UserAgentHeader];
         wsArgs.Headers[AWSSDKUtils.UserAgentHeader] = currentUserAgent + " " + this.TableConsumer.ToString();
     }
 }
 private void SetDryRunParameterCallback(object sender, RequestEventArgs args)
 {
     WebServiceRequestEventArgs wsrea = args as WebServiceRequestEventArgs;
     if (wsrea != null)
     {
         wsrea.Parameters["DryRun"] = "true";
     }
 }
Пример #13
0
 void IRequestEvents.FireBeforeRequestEvent(object sender, RequestEventArgs args)
 {
     if (BeforeRequestEvent != null)
         BeforeRequestEvent(sender, args);
 }
Пример #14
0
 void IRequestEvents.FireBeforeRequestEvent(object sender, RequestEventArgs args)
 {
     ((AmazonWebServiceRequest)this).FireBeforeRequestEvent(sender, args);
 }
Пример #15
0
 private void UserAgentRequestEventHandler(object sender, RequestEventArgs args, bool isAsync)
 {
     WebServiceRequestEventArgs wsArgs = args as WebServiceRequestEventArgs;
     if (wsArgs != null)
     {
         if (wsArgs.Headers.Keys.Contains(HeaderKeys.UserAgentHeader))
         {
             string currentUserAgent = wsArgs.Headers[HeaderKeys.UserAgentHeader];
             wsArgs.Headers[HeaderKeys.UserAgentHeader] =
             currentUserAgent + " " + this.TableConsumer.ToString() + " " + (isAsync ? "TableAsync" : "TableSync");
     }
         else if(wsArgs.Headers.Keys.Contains(HeaderKeys.XAmzUserAgentHeader))
         {
             string currentUserAgent = wsArgs.Headers[HeaderKeys.XAmzUserAgentHeader];
             wsArgs.Headers[HeaderKeys.XAmzUserAgentHeader] =
                 currentUserAgent + " " + this.TableConsumer.ToString() + " " + (isAsync ? "TableAsync" : "TableSync");
 }
     }
 }
 void IRequestEvents.FireBeforeRequestEvent(object sender, RequestEventArgs args)
 {
     ((AmazonWebServiceRequest)this).FireBeforeRequestEvent(sender, args);
 }
 private void UserAgentRequestEventHandler(object sender, RequestEventArgs args)
 {
     WebServiceRequestEventArgs wsArgs = args as WebServiceRequestEventArgs;
     if (wsArgs != null)
     {
         string currentUserAgent = wsArgs.Headers[AWSSDKUtils.UserAgentHeader];
         wsArgs.Headers[AWSSDKUtils.UserAgentHeader] = currentUserAgent + " SessionStateProvider";
     }
 }
Пример #18
0
 internal void UserAgentRequestEventHandlerSync(object sender, RequestEventArgs args)
 {
     WebServiceRequestEventArgs wsArgs = args as WebServiceRequestEventArgs;
     if (wsArgs != null)
     {
         string currentUserAgent = wsArgs.Headers[AWSSDKUtils.UserAgentHeader];
         wsArgs.Headers[AWSSDKUtils.UserAgentHeader] = currentUserAgent + " ArchiveTransferManager/" + this.operation;
     }
 }
        void DynamoDBSessionStateStore_BeforeRequestEvent(object sender, RequestEventArgs e)
        {
            Amazon.Runtime.WebServiceRequestEventArgs args = e as Amazon.Runtime.WebServiceRequestEventArgs;
            if (args == null || !args.Headers.ContainsKey(UserAgentHeader))
                return;

            args.Headers[UserAgentHeader] = args.Headers[UserAgentHeader] + " SessionStateProvider";
        }
        void BeforeRequestEvents(object sender, RequestEventArgs args)
        {
            var webArgs = args as WebServiceRequestEventArgs;
            if (webArgs != null)
            {
                var originalRequest = webArgs.Request;

                var rsir = originalRequest as RequestSpotInstancesRequest;
                if (rsir != null)
                {
                    if (rsir.LaunchSpecification != null && rsir.LaunchSpecification.AllSecurityGroups != null)
                    {
                        int count = 1;
                        foreach (var group in rsir.LaunchSpecification.AllSecurityGroups)
                        {
                            if (group != null && group.GroupId != null)
                            {
                                string key = "LaunchSpecification.SecurityGroupId." + count++;
                                webArgs.Parameters[key] = group.GroupId;
                            }
                        }
                    }

                    var keysToRemove = new List<string>();
                    foreach (var parameter in webArgs.Parameters.Keys)
                    {
                        if (parameter.StartsWith("LaunchSpecification.GroupSet.", StringComparison.Ordinal))
                            keysToRemove.Add(parameter);
                    }
                    foreach (var key in keysToRemove)
                    {
                        webArgs.Parameters.Remove(key);
                    }
                }
            }
        }