Container for the parameters to the CreateLogStream operation. Creates a log stream for the specified log group.

There is no limit on the number of log streams that you can create for a log group.

You must use the following guidelines when naming a log stream:

  • Log stream names must be unique within the log group.

  • Log stream names can be between 1 and 512 characters long.

  • The ':' (colon) and '*' (asterisk) characters are not allowed.

Inheritance: AmazonCloudWatchLogsRequest
        /// <summary>
        /// Initiates the asynchronous execution of the CreateLogStream operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateLogStream 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<CreateLogStreamResponse> CreateLogStreamAsync(CreateLogStreamRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateLogStreamRequestMarshaller();
            var unmarshaller = CreateLogStreamResponseUnmarshaller.Instance;

            return InvokeAsync<CreateLogStreamRequest,CreateLogStreamResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
        void Writer(object sender, ElapsedEventArgs e)
        {
            try
            {
                var logEvents = new List<InputLogEvent>();

                var more = true;
                while (more)
                {
                    InputLogEvent item;
                    more = items.TryTake(out item);
                    if (more)
                        logEvents.Add(item);
                }

                if (logEvents.Count == 0)
                    return;

                if (!Settings.Default.SendUsageData)
                    return;

                using (var logs = new AmazonCloudWatchLogsClient(AwsKeys.AccessKey, AwsKeys.SecretKey, RegionEndpoint.APSoutheast2))
                {
                    var request = new PutLogEventsRequest(AwsKeys.GroupName, LogStreamName, logEvents);

                    var describeLogStreamsRequest = new DescribeLogStreamsRequest(AwsKeys.GroupName);
                    var describeLogStreamsResponse = logs.DescribeLogStreams(describeLogStreamsRequest);
                    var logStreams = describeLogStreamsResponse.LogStreams;
                    var logStream = logStreams.FirstOrDefault(ls => ls.LogStreamName == LogStreamName);
                    if (logStream != null)
                    {
                        var token = logStream.UploadSequenceToken;
                        request.SequenceToken = token;
                        checkResponse(logs.PutLogEvents(request));
                    }
                    else
                    {
                        var createRequest = new CreateLogStreamRequest(AwsKeys.GroupName, LogStreamName);
                        checkResponse(logs.CreateLogStream(createRequest));
                        checkResponse(logs.PutLogEvents(request));
                    }
                }
            }
            catch(Exception ee)
            {
                TraceInfo.WriteLine(ee.Message);
                TraceDebug.WriteLine(ee.StackTrace);
            }
            finally
            {
                if(timer != null)
                    timer.Start();
            }
        }
        /// <summary>
        /// Creates a new log stream in the specified log group. The name of the log stream must
        /// be unique within the log group. There is no limit on the number of log streams that
        /// can exist in a log group. 
        /// 
        ///  
        /// <para>
        ///  You must use the following guidelines when naming a log stream: <ul> <li>Log stream
        /// names can be between 1 and 512 characters long.</li> <li>The ':' colon character is
        /// not allowed.</li> </ul> 
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the CreateLogStream service method.</param>
        /// 
        /// <returns>The response from the CreateLogStream service method, as returned by CloudWatchLogs.</returns>
        /// <exception cref="Amazon.CloudWatchLogs.Model.InvalidParameterException">
        /// Returned if a parameter of the request is incorrectly specified.
        /// </exception>
        /// <exception cref="Amazon.CloudWatchLogs.Model.ResourceAlreadyExistsException">
        /// Returned if the specified resource already exists.
        /// </exception>
        /// <exception cref="Amazon.CloudWatchLogs.Model.ResourceNotFoundException">
        /// Returned if the specified resource does not exist.
        /// </exception>
        /// <exception cref="Amazon.CloudWatchLogs.Model.ServiceUnavailableException">
        /// Returned if the service cannot complete the request.
        /// </exception>
        public CreateLogStreamResponse CreateLogStream(CreateLogStreamRequest request)
        {
            var marshaller = new CreateLogStreamRequestMarshaller();
            var unmarshaller = CreateLogStreamResponseUnmarshaller.Instance;

            return Invoke<CreateLogStreamRequest,CreateLogStreamResponse>(request, marshaller, unmarshaller);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the CreateLogStream operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateLogStream operation on AmazonCloudWatchLogsClient.</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 EndCreateLogStream
        ///         operation.</returns>
        public IAsyncResult BeginCreateLogStream(CreateLogStreamRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new CreateLogStreamRequestMarshaller();
            var unmarshaller = CreateLogStreamResponseUnmarshaller.Instance;

            return BeginInvoke<CreateLogStreamRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
        IAsyncResult invokeCreateLogStream(CreateLogStreamRequest request, AsyncCallback callback, object state, bool synchronized)
        {
            var marshaller = new CreateLogStreamRequestMarshaller();
            var unmarshaller = CreateLogStreamResponseUnmarshaller.Instance;

            return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer);
        }
 /// <summary>
 /// Initiates the asynchronous execution of the CreateLogStream operation.
 /// <seealso cref="Amazon.CloudWatchLogs.IAmazonCloudWatchLogs"/>
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the CreateLogStream operation on AmazonCloudWatchLogsClient.</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 EndCreateLogStream
 ///         operation.</returns>
 public IAsyncResult BeginCreateLogStream(CreateLogStreamRequest request, AsyncCallback callback, object state)
 {
     return invokeCreateLogStream(request, callback, state, false);
 }
 /// <summary>
 /// Creates a new log stream in the specified log group. The name of the log stream must
 /// be unique within the log group. There is no limit on the number of log streams that
 /// can exist in a log group. 
 /// 
 ///  
 /// <para>
 ///  You must use the following guidelines when naming a log stream: <ul> <li>Log stream
 /// names can be between 1 and 512 characters long.</li> <li>The ':' colon character is
 /// not allowed.</li> </ul> 
 /// </para>
 /// </summary>
 /// <param name="request">Container for the necessary parameters to execute the CreateLogStream service method.</param>
 /// 
 /// <returns>The response from the CreateLogStream service method, as returned by CloudWatchLogs.</returns>
 /// <exception cref="InvalidParameterException">
 /// Returned if a parameter of the request is incorrectly specified.
 /// </exception>
 /// <exception cref="ResourceAlreadyExistsException">
 /// Returned if the specified resource already exists.
 /// </exception>
 /// <exception cref="ResourceNotFoundException">
 /// Returned if the specified resource does not exist.
 /// </exception>
 /// <exception cref="ServiceUnavailableException">
 /// Returned if the service cannot complete the request.
 /// </exception>
 public CreateLogStreamResponse CreateLogStream(CreateLogStreamRequest request)
 {
     IAsyncResult asyncResult = invokeCreateLogStream(request, null, null, true);
     return EndCreateLogStream(asyncResult);
 }
 /// <summary>
 /// Creates a new log stream in the specified log group. The name of the log stream must
 /// be unique within the log group. There is no limit on the number of log streams that
 /// can exist in a log group. 
 /// 
 ///  
 /// <para>
 ///  You must use the following guidelines when naming a log stream: <ul> <li>Log stream
 /// names can be between 1 and 512 characters long.</li> <li>The ':' colon character is
 /// not allowed.</li> </ul> 
 /// </para>
 /// </summary>
 /// <param name="request">Container for the necessary parameters to execute the CreateLogStream service method.</param>
 /// 
 /// <returns>The response from the CreateLogStream service method, as returned by CloudWatchLogs.</returns>
 /// <exception cref="InvalidParameterException">
 /// Returned if a parameter of the request is incorrectly specified.
 /// </exception>
 /// <exception cref="ResourceAlreadyExistsException">
 /// Returned if the specified resource already exists.
 /// </exception>
 /// <exception cref="ResourceNotFoundException">
 /// Returned if the specified resource does not exist.
 /// </exception>
 /// <exception cref="ServiceUnavailableException">
 /// Returned if the service cannot complete the request.
 /// </exception>
 public CreateLogStreamResponse CreateLogStream(CreateLogStreamRequest request)
 {
     var task = CreateLogStreamAsync(request);
     try
     {
         return task.Result;
     }
     catch(AggregateException e)
     {
         ExceptionDispatchInfo.Capture(e.InnerException).Throw();
         return null;
     }
 }