Container for the parameters to the LookupEvents operation. Looks up API activity events captured by CloudTrail that create, update, or delete resources in your account. Events for a region can be looked up for the times in which you had CloudTrail turned on in that region during the last seven days. Lookup supports the following attributes:
  • Event ID

  • Event name

  • Resource name

  • Resource type

  • User name

All attributes are optional. The default number of results returned is 10, with a maximum of 50 possible. The response includes a token that you can use to get the next page of results.

The rate of lookup requests is limited to one per second per account. If this limit is exceeded, a throttling error occurs.

Events that occurred during the selected time range will not be available for lookup if CloudTrail logging was not enabled when the events occurred.

Inheritance: AmazonCloudTrailRequest
        /// <summary>
        /// Looks up API activity events captured by CloudTrail that create, update, or delete
        /// resources in your account. Events for a region can be looked up for the times in which
        /// you had CloudTrail turned on in that region during the last seven days. Lookup supports
        /// five different attributes: time range (defined by a start time and end time), user
        /// name, event name, resource type, and resource name. All attributes are optional. The
        /// maximum number of attributes that can be specified in any one lookup request are time
        /// range and one other attribute. The default number of results returned is 10, with
        /// a maximum of 50 possible. The response includes a token that you can use to get the
        /// next page of results. 
        /// 
        ///  <important>The rate of lookup requests is limited to one per second per account.
        /// If this limit is exceeded, a throttling error occurs. </important> <important>Events
        /// that occurred during the selected time range will not be available for lookup if CloudTrail
        /// logging was not enabled when the events occurred.</important>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the LookupEvents service method.</param>
        /// 
        /// <returns>The response from the LookupEvents service method, as returned by CloudTrail.</returns>
        /// <exception cref="Amazon.CloudTrail.Model.InvalidLookupAttributesException">
        /// Occurs when an invalid lookup attribute is specified.
        /// </exception>
        /// <exception cref="Amazon.CloudTrail.Model.InvalidMaxResultsException">
        /// This exception is thrown if the limit specified is invalid.
        /// </exception>
        /// <exception cref="Amazon.CloudTrail.Model.InvalidNextTokenException">
        /// Invalid token or token that was previously used in a request with different parameters.
        /// This exception is thrown if the token is invalid.
        /// </exception>
        /// <exception cref="Amazon.CloudTrail.Model.InvalidTimeRangeException">
        /// Occurs if the timestamp values are invalid. Either the start time occurs after the
        /// end time or the time range is outside the range of possible values.
        /// </exception>
        public LookupEventsResponse LookupEvents(LookupEventsRequest request)
        {
            var marshaller = new LookupEventsRequestMarshaller();
            var unmarshaller = LookupEventsResponseUnmarshaller.Instance;

            return Invoke<LookupEventsRequest,LookupEventsResponse>(request, marshaller, unmarshaller);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the LookupEvents operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the LookupEvents operation on AmazonCloudTrailClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndLookupEvents
        ///         operation.</returns>
        public IAsyncResult BeginLookupEvents(LookupEventsRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new LookupEventsRequestMarshaller();
            var unmarshaller = LookupEventsResponseUnmarshaller.Instance;

            return BeginInvoke<LookupEventsRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the LookupEvents operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the LookupEvents operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task<LookupEventsResponse> LookupEventsAsync(LookupEventsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new LookupEventsRequestMarshaller();
            var unmarshaller = LookupEventsResponseUnmarshaller.Instance;

            return InvokeAsync<LookupEventsRequest,LookupEventsResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
 private Amazon.CloudTrail.Model.LookupEventsResponse CallAWSServiceOperation(IAmazonCloudTrail client, Amazon.CloudTrail.Model.LookupEventsRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS CloudTrail", "LookupEvents");
     try
     {
         #if DESKTOP
         return(client.LookupEvents(request));
         #elif CORECLR
         return(client.LookupEventsAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }
        public object Execute(ExecutorContext context)
        {
            var cmdletContext      = context as CmdletContext;
            var useParameterSelect = this.Select.StartsWith("^");

            // create request and set iteration invariants
            var request = new Amazon.CloudTrail.Model.LookupEventsRequest();

            if (cmdletContext.EndTime != null)
            {
                request.EndTime = cmdletContext.EndTime.Value;
            }
            if (cmdletContext.EventCategory != null)
            {
                request.EventCategory = cmdletContext.EventCategory;
            }
            if (cmdletContext.LookupAttribute != null)
            {
                request.LookupAttributes = cmdletContext.LookupAttribute;
            }
            if (cmdletContext.MaxResult != null)
            {
                request.MaxResults = cmdletContext.MaxResult.Value;
            }
            if (cmdletContext.StartTime != null)
            {
                request.StartTime = cmdletContext.StartTime.Value;
            }

            // Initialize loop variant and commence piping
            var _nextToken             = cmdletContext.NextToken;
            var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.NextToken));

            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);

            do
            {
                request.NextToken = _nextToken;

                CmdletOutput output;

                try
                {
                    var response = CallAWSServiceOperation(client, request);

                    object pipelineOutput = null;
                    if (!useParameterSelect)
                    {
                        pipelineOutput = cmdletContext.Select(response, this);
                    }
                    output = new CmdletOutput
                    {
                        PipelineOutput  = pipelineOutput,
                        ServiceResponse = response
                    };

                    _nextToken = response.NextToken;
                }
                catch (Exception e)
                {
                    output = new CmdletOutput {
                        ErrorResponse = e
                    };
                }

                ProcessOutput(output);
            } while (!_userControllingPaging && AutoIterationHelpers.HasValue(_nextToken));

            if (useParameterSelect)
            {
                WriteObject(cmdletContext.Select(null, this));
            }


            return(null);
        }
Example #6
0
 internal LookupEventsPaginator(IAmazonCloudTrail client, LookupEventsRequest request)
 {
     this._client  = client;
     this._request = request;
 }
Example #7
0
 /// <summary>
 /// Paginator for LookupEvents operation
 ///</summary>
 public ILookupEventsPaginator LookupEvents(LookupEventsRequest request)
 {
     return(new LookupEventsPaginator(this.client, request));
 }