api_op_GetContainerLog.go raw

   1  // Code generated by smithy-go-codegen DO NOT EDIT.
   2  
   3  package lightsail
   4  
   5  import (
   6  	"context"
   7  	"fmt"
   8  	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
   9  	"github.com/aws/aws-sdk-go-v2/service/lightsail/types"
  10  	"github.com/aws/smithy-go/middleware"
  11  	smithyhttp "github.com/aws/smithy-go/transport/http"
  12  	"time"
  13  )
  14  
  15  // Returns the log events of a container of your Amazon Lightsail container
  16  // service.
  17  //
  18  // If your container service has more than one node (i.e., a scale greater than
  19  // 1), then the log events that are returned for the specified container are merged
  20  // from all nodes on your container service.
  21  //
  22  // Container logs are retained for a certain amount of time. For more information,
  23  // see [Amazon Lightsail endpoints and quotas]in the Amazon Web Services General Reference.
  24  //
  25  // [Amazon Lightsail endpoints and quotas]: https://docs.aws.amazon.com/general/latest/gr/lightsail.html
  26  func (c *Client) GetContainerLog(ctx context.Context, params *GetContainerLogInput, optFns ...func(*Options)) (*GetContainerLogOutput, error) {
  27  	if params == nil {
  28  		params = &GetContainerLogInput{}
  29  	}
  30  
  31  	result, metadata, err := c.invokeOperation(ctx, "GetContainerLog", params, optFns, c.addOperationGetContainerLogMiddlewares)
  32  	if err != nil {
  33  		return nil, err
  34  	}
  35  
  36  	out := result.(*GetContainerLogOutput)
  37  	out.ResultMetadata = metadata
  38  	return out, nil
  39  }
  40  
  41  type GetContainerLogInput struct {
  42  
  43  	// The name of the container that is either running or previously ran on the
  44  	// container service for which to return a log.
  45  	//
  46  	// This member is required.
  47  	ContainerName *string
  48  
  49  	// The name of the container service for which to get a container log.
  50  	//
  51  	// This member is required.
  52  	ServiceName *string
  53  
  54  	// The end of the time interval for which to get log data.
  55  	//
  56  	// Constraints:
  57  	//
  58  	//   - Specified in Coordinated Universal Time (UTC).
  59  	//
  60  	//   - Specified in the Unix time format.
  61  	//
  62  	// For example, if you wish to use an end time of October 1, 2018, at 9 PM UTC,
  63  	//   specify 1538427600 as the end time.
  64  	//
  65  	// You can convert a human-friendly time to Unix time format using a converter
  66  	// like [Epoch converter].
  67  	//
  68  	// [Epoch converter]: https://www.epochconverter.com/
  69  	EndTime *time.Time
  70  
  71  	// The pattern to use to filter the returned log events to a specific term.
  72  	//
  73  	// The following are a few examples of filter patterns that you can specify:
  74  	//
  75  	//   - To return all log events, specify a filter pattern of "" .
  76  	//
  77  	//   - To exclude log events that contain the ERROR term, and return all other log
  78  	//   events, specify a filter pattern of "-ERROR" .
  79  	//
  80  	//   - To return log events that contain the ERROR term, specify a filter pattern
  81  	//   of "ERROR" .
  82  	//
  83  	//   - To return log events that contain both the ERROR and Exception terms,
  84  	//   specify a filter pattern of "ERROR Exception" .
  85  	//
  86  	//   - To return log events that contain the ERROR or the Exception term, specify a
  87  	//   filter pattern of "?ERROR ?Exception" .
  88  	FilterPattern *string
  89  
  90  	// The token to advance to the next page of results from your request.
  91  	//
  92  	// To get a page token, perform an initial GetContainerLog request. If your
  93  	// results are paginated, the response will return a next page token that you can
  94  	// specify as the page token in a subsequent request.
  95  	PageToken *string
  96  
  97  	// The start of the time interval for which to get log data.
  98  	//
  99  	// Constraints:
 100  	//
 101  	//   - Specified in Coordinated Universal Time (UTC).
 102  	//
 103  	//   - Specified in the Unix time format.
 104  	//
 105  	// For example, if you wish to use a start time of October 1, 2018, at 8 PM UTC,
 106  	//   specify 1538424000 as the start time.
 107  	//
 108  	// You can convert a human-friendly time to Unix time format using a converter
 109  	// like [Epoch converter].
 110  	//
 111  	// [Epoch converter]: https://www.epochconverter.com/
 112  	StartTime *time.Time
 113  
 114  	noSmithyDocumentSerde
 115  }
 116  
 117  type GetContainerLogOutput struct {
 118  
 119  	// An array of objects that describe the log events of a container.
 120  	LogEvents []types.ContainerServiceLogEvent
 121  
 122  	// The token to advance to the next page of results from your request.
 123  	//
 124  	// A next page token is not returned if there are no more results to display.
 125  	//
 126  	// To get the next page of results, perform another GetContainerLog request and
 127  	// specify the next page token using the pageToken parameter.
 128  	NextPageToken *string
 129  
 130  	// Metadata pertaining to the operation's result.
 131  	ResultMetadata middleware.Metadata
 132  
 133  	noSmithyDocumentSerde
 134  }
 135  
 136  func (c *Client) addOperationGetContainerLogMiddlewares(stack *middleware.Stack, options Options) (err error) {
 137  	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
 138  		return err
 139  	}
 140  	err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetContainerLog{}, middleware.After)
 141  	if err != nil {
 142  		return err
 143  	}
 144  	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetContainerLog{}, middleware.After)
 145  	if err != nil {
 146  		return err
 147  	}
 148  	if err := addProtocolFinalizerMiddlewares(stack, options, "GetContainerLog"); err != nil {
 149  		return fmt.Errorf("add protocol finalizers: %v", err)
 150  	}
 151  
 152  	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
 153  		return err
 154  	}
 155  	if err = addSetLoggerMiddleware(stack, options); err != nil {
 156  		return err
 157  	}
 158  	if err = addClientRequestID(stack); err != nil {
 159  		return err
 160  	}
 161  	if err = addComputeContentLength(stack); err != nil {
 162  		return err
 163  	}
 164  	if err = addResolveEndpointMiddleware(stack, options); err != nil {
 165  		return err
 166  	}
 167  	if err = addComputePayloadSHA256(stack); err != nil {
 168  		return err
 169  	}
 170  	if err = addRetry(stack, options); err != nil {
 171  		return err
 172  	}
 173  	if err = addRawResponseToMetadata(stack); err != nil {
 174  		return err
 175  	}
 176  	if err = addRecordResponseTiming(stack); err != nil {
 177  		return err
 178  	}
 179  	if err = addSpanRetryLoop(stack, options); err != nil {
 180  		return err
 181  	}
 182  	if err = addClientUserAgent(stack, options); err != nil {
 183  		return err
 184  	}
 185  	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
 186  		return err
 187  	}
 188  	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
 189  		return err
 190  	}
 191  	if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
 192  		return err
 193  	}
 194  	if err = addTimeOffsetBuild(stack, c); err != nil {
 195  		return err
 196  	}
 197  	if err = addUserAgentRetryMode(stack, options); err != nil {
 198  		return err
 199  	}
 200  	if err = addCredentialSource(stack, options); err != nil {
 201  		return err
 202  	}
 203  	if err = addOpGetContainerLogValidationMiddleware(stack); err != nil {
 204  		return err
 205  	}
 206  	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetContainerLog(options.Region), middleware.Before); err != nil {
 207  		return err
 208  	}
 209  	if err = addRecursionDetection(stack); err != nil {
 210  		return err
 211  	}
 212  	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
 213  		return err
 214  	}
 215  	if err = addResponseErrorMiddleware(stack); err != nil {
 216  		return err
 217  	}
 218  	if err = addRequestResponseLogging(stack, options); err != nil {
 219  		return err
 220  	}
 221  	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
 222  		return err
 223  	}
 224  	if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
 225  		return err
 226  	}
 227  	if err = addInterceptAttempt(stack, options); err != nil {
 228  		return err
 229  	}
 230  	if err = addInterceptors(stack, options); err != nil {
 231  		return err
 232  	}
 233  	return nil
 234  }
 235  
 236  func newServiceMetadataMiddleware_opGetContainerLog(region string) *awsmiddleware.RegisterServiceMetadata {
 237  	return &awsmiddleware.RegisterServiceMetadata{
 238  		Region:        region,
 239  		ServiceID:     ServiceID,
 240  		OperationName: "GetContainerLog",
 241  	}
 242  }
 243