|
|
@@ -3,14 +3,21 @@
|
|
|
package s3
|
|
|
|
|
|
import (
|
|
|
+ "bytes"
|
|
|
"fmt"
|
|
|
"io"
|
|
|
+ "sync"
|
|
|
+ "sync/atomic"
|
|
|
"time"
|
|
|
|
|
|
"github.com/aws/aws-sdk-go/aws"
|
|
|
"github.com/aws/aws-sdk-go/aws/awsutil"
|
|
|
+ "github.com/aws/aws-sdk-go/aws/client"
|
|
|
"github.com/aws/aws-sdk-go/aws/request"
|
|
|
"github.com/aws/aws-sdk-go/private/protocol"
|
|
|
+ "github.com/aws/aws-sdk-go/private/protocol/eventstream"
|
|
|
+ "github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi"
|
|
|
+ "github.com/aws/aws-sdk-go/private/protocol/rest"
|
|
|
"github.com/aws/aws-sdk-go/private/protocol/restxml"
|
|
|
)
|
|
|
|
|
|
@@ -6017,6 +6024,88 @@ func (c *S3) RestoreObjectWithContext(ctx aws.Context, input *RestoreObjectInput
|
|
|
return out, req.Send()
|
|
|
}
|
|
|
|
|
|
+const opSelectObjectContent = "SelectObjectContent"
|
|
|
+
|
|
|
+// SelectObjectContentRequest generates a "aws/request.Request" representing the
|
|
|
+// client's request for the SelectObjectContent operation. The "output" return
|
|
|
+// value will be populated with the request's response once the request completes
|
|
|
+// successfuly.
|
|
|
+//
|
|
|
+// Use "Send" method on the returned Request to send the API call to the service.
|
|
|
+// the "output" return value is not valid until after Send returns without error.
|
|
|
+//
|
|
|
+// See SelectObjectContent for more information on using the SelectObjectContent
|
|
|
+// API call, and error handling.
|
|
|
+//
|
|
|
+// This method is useful when you want to inject custom logic or configuration
|
|
|
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
|
|
|
+//
|
|
|
+//
|
|
|
+// // Example sending a request using the SelectObjectContentRequest method.
|
|
|
+// req, resp := client.SelectObjectContentRequest(params)
|
|
|
+//
|
|
|
+// err := req.Send()
|
|
|
+// if err == nil { // resp is now filled
|
|
|
+// fmt.Println(resp)
|
|
|
+// }
|
|
|
+//
|
|
|
+// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/SelectObjectContent
|
|
|
+func (c *S3) SelectObjectContentRequest(input *SelectObjectContentInput) (req *request.Request, output *SelectObjectContentOutput) {
|
|
|
+ op := &request.Operation{
|
|
|
+ Name: opSelectObjectContent,
|
|
|
+ HTTPMethod: "POST",
|
|
|
+ HTTPPath: "/{Bucket}/{Key+}?select&select-type=2",
|
|
|
+ }
|
|
|
+
|
|
|
+ if input == nil {
|
|
|
+ input = &SelectObjectContentInput{}
|
|
|
+ }
|
|
|
+
|
|
|
+ output = &SelectObjectContentOutput{}
|
|
|
+ req = c.newRequest(op, input, output)
|
|
|
+ req.Handlers.Send.Swap(client.LogHTTPResponseHandler.Name, client.LogHTTPResponseHeaderHandler)
|
|
|
+ req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, rest.UnmarshalHandler)
|
|
|
+ req.Handlers.Unmarshal.PushBack(output.runEventStreamLoop)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// SelectObjectContent API operation for Amazon Simple Storage Service.
|
|
|
+//
|
|
|
+// This operation filters the contents of an Amazon S3 object based on a simple
|
|
|
+// Structured Query Language (SQL) statement. In the request, along with the
|
|
|
+// SQL expression, you must also specify a data serialization format (JSON or
|
|
|
+// CSV) of the object. Amazon S3 uses this to parse object data into records,
|
|
|
+// and returns only records that match the specified SQL expression. You must
|
|
|
+// also specify the data serialization format for the response.
|
|
|
+//
|
|
|
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
|
|
|
+// with awserr.Error's Code and Message methods to get detailed information about
|
|
|
+// the error.
|
|
|
+//
|
|
|
+// See the AWS API reference guide for Amazon Simple Storage Service's
|
|
|
+// API operation SelectObjectContent for usage and error information.
|
|
|
+// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/SelectObjectContent
|
|
|
+func (c *S3) SelectObjectContent(input *SelectObjectContentInput) (*SelectObjectContentOutput, error) {
|
|
|
+ req, out := c.SelectObjectContentRequest(input)
|
|
|
+ return out, req.Send()
|
|
|
+}
|
|
|
+
|
|
|
+// SelectObjectContentWithContext is the same as SelectObjectContent with the addition of
|
|
|
+// the ability to pass a context and additional request options.
|
|
|
+//
|
|
|
+// See SelectObjectContent for details on how to use this API operation.
|
|
|
+//
|
|
|
+// The context must be non-nil and will be used for request cancellation. If
|
|
|
+// the context is nil a panic will occur. In the future the SDK may create
|
|
|
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
|
|
|
+// for more information on using Contexts.
|
|
|
+func (c *S3) SelectObjectContentWithContext(ctx aws.Context, input *SelectObjectContentInput, opts ...request.Option) (*SelectObjectContentOutput, error) {
|
|
|
+ req, out := c.SelectObjectContentRequest(input)
|
|
|
+ req.SetContext(ctx)
|
|
|
+ req.ApplyOptions(opts...)
|
|
|
+ return out, req.Send()
|
|
|
+}
|
|
|
+
|
|
|
const opUploadPart = "UploadPart"
|
|
|
|
|
|
// UploadPartRequest generates a "aws/request.Request" representing the
|
|
|
@@ -7474,6 +7563,32 @@ func (s *Condition) SetKeyPrefixEquals(v string) *Condition {
|
|
|
return s
|
|
|
}
|
|
|
|
|
|
+type ContinuationEvent struct {
|
|
|
+ _ struct{} `type:"structure"`
|
|
|
+}
|
|
|
+
|
|
|
+// String returns the string representation
|
|
|
+func (s ContinuationEvent) String() string {
|
|
|
+ return awsutil.Prettify(s)
|
|
|
+}
|
|
|
+
|
|
|
+// GoString returns the string representation
|
|
|
+func (s ContinuationEvent) GoString() string {
|
|
|
+ return s.String()
|
|
|
+}
|
|
|
+
|
|
|
+// The ContinuationEvent is and event in the SelectObjectContentEventStream group of events.
|
|
|
+func (s *ContinuationEvent) eventSelectObjectContentEventStream() {}
|
|
|
+
|
|
|
+// UnmarshalEvent unmarshals the EventStream Message into the ContinuationEvent value.
|
|
|
+// This method is only used internally within the SDK's EventStream handling.
|
|
|
+func (s *ContinuationEvent) UnmarshalEvent(
|
|
|
+ payloadUnmarshaler protocol.PayloadUnmarshaler,
|
|
|
+ msg eventstream.Message,
|
|
|
+) error {
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
type CopyObjectInput struct {
|
|
|
_ struct{} `type:"structure"`
|
|
|
|
|
|
@@ -9919,6 +10034,32 @@ func (s *EncryptionConfiguration) SetReplicaKmsKeyID(v string) *EncryptionConfig
|
|
|
return s
|
|
|
}
|
|
|
|
|
|
+type EndEvent struct {
|
|
|
+ _ struct{} `type:"structure"`
|
|
|
+}
|
|
|
+
|
|
|
+// String returns the string representation
|
|
|
+func (s EndEvent) String() string {
|
|
|
+ return awsutil.Prettify(s)
|
|
|
+}
|
|
|
+
|
|
|
+// GoString returns the string representation
|
|
|
+func (s EndEvent) GoString() string {
|
|
|
+ return s.String()
|
|
|
+}
|
|
|
+
|
|
|
+// The EndEvent is and event in the SelectObjectContentEventStream group of events.
|
|
|
+func (s *EndEvent) eventSelectObjectContentEventStream() {}
|
|
|
+
|
|
|
+// UnmarshalEvent unmarshals the EventStream Message into the EndEvent value.
|
|
|
+// This method is only used internally within the SDK's EventStream handling.
|
|
|
+func (s *EndEvent) UnmarshalEvent(
|
|
|
+ payloadUnmarshaler protocol.PayloadUnmarshaler,
|
|
|
+ msg eventstream.Message,
|
|
|
+) error {
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
type Error struct {
|
|
|
_ struct{} `type:"structure"`
|
|
|
|
|
|
@@ -16380,6 +16521,87 @@ func (s *Part) SetSize(v int64) *Part {
|
|
|
return s
|
|
|
}
|
|
|
|
|
|
+type Progress struct {
|
|
|
+ _ struct{} `type:"structure"`
|
|
|
+
|
|
|
+ // Current number of uncompressed object bytes processed.
|
|
|
+ BytesProcessed *int64 `type:"long"`
|
|
|
+
|
|
|
+ // Current number of bytes of records payload data returned.
|
|
|
+ BytesReturned *int64 `type:"long"`
|
|
|
+
|
|
|
+ // Current number of object bytes scanned.
|
|
|
+ BytesScanned *int64 `type:"long"`
|
|
|
+}
|
|
|
+
|
|
|
+// String returns the string representation
|
|
|
+func (s Progress) String() string {
|
|
|
+ return awsutil.Prettify(s)
|
|
|
+}
|
|
|
+
|
|
|
+// GoString returns the string representation
|
|
|
+func (s Progress) GoString() string {
|
|
|
+ return s.String()
|
|
|
+}
|
|
|
+
|
|
|
+// SetBytesProcessed sets the BytesProcessed field's value.
|
|
|
+func (s *Progress) SetBytesProcessed(v int64) *Progress {
|
|
|
+ s.BytesProcessed = &v
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+// SetBytesReturned sets the BytesReturned field's value.
|
|
|
+func (s *Progress) SetBytesReturned(v int64) *Progress {
|
|
|
+ s.BytesReturned = &v
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+// SetBytesScanned sets the BytesScanned field's value.
|
|
|
+func (s *Progress) SetBytesScanned(v int64) *Progress {
|
|
|
+ s.BytesScanned = &v
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+type ProgressEvent struct {
|
|
|
+ _ struct{} `type:"structure" payload:"Details"`
|
|
|
+
|
|
|
+ // The Progress event details.
|
|
|
+ Details *Progress `locationName:"Details" type:"structure"`
|
|
|
+}
|
|
|
+
|
|
|
+// String returns the string representation
|
|
|
+func (s ProgressEvent) String() string {
|
|
|
+ return awsutil.Prettify(s)
|
|
|
+}
|
|
|
+
|
|
|
+// GoString returns the string representation
|
|
|
+func (s ProgressEvent) GoString() string {
|
|
|
+ return s.String()
|
|
|
+}
|
|
|
+
|
|
|
+// SetDetails sets the Details field's value.
|
|
|
+func (s *ProgressEvent) SetDetails(v *Progress) *ProgressEvent {
|
|
|
+ s.Details = v
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+// The ProgressEvent is and event in the SelectObjectContentEventStream group of events.
|
|
|
+func (s *ProgressEvent) eventSelectObjectContentEventStream() {}
|
|
|
+
|
|
|
+// UnmarshalEvent unmarshals the EventStream Message into the ProgressEvent value.
|
|
|
+// This method is only used internally within the SDK's EventStream handling.
|
|
|
+func (s *ProgressEvent) UnmarshalEvent(
|
|
|
+ payloadUnmarshaler protocol.PayloadUnmarshaler,
|
|
|
+ msg eventstream.Message,
|
|
|
+) error {
|
|
|
+ if err := payloadUnmarshaler.UnmarshalPayload(
|
|
|
+ bytes.NewReader(msg.Payload), s,
|
|
|
+ ); err != nil {
|
|
|
+ return fmt.Errorf("failed to unmarshal payload, %v", err)
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
type PutBucketAccelerateConfigurationInput struct {
|
|
|
_ struct{} `type:"structure" payload:"AccelerateConfiguration"`
|
|
|
|
|
|
@@ -18622,6 +18844,45 @@ func (s *QueueConfigurationDeprecated) SetQueue(v string) *QueueConfigurationDep
|
|
|
return s
|
|
|
}
|
|
|
|
|
|
+type RecordsEvent struct {
|
|
|
+ _ struct{} `type:"structure" payload:"Payload"`
|
|
|
+
|
|
|
+ // The byte array of partial, one or more result records.
|
|
|
+ //
|
|
|
+ // Payload is automatically base64 encoded/decoded by the SDK.
|
|
|
+ Payload []byte `type:"blob"`
|
|
|
+}
|
|
|
+
|
|
|
+// String returns the string representation
|
|
|
+func (s RecordsEvent) String() string {
|
|
|
+ return awsutil.Prettify(s)
|
|
|
+}
|
|
|
+
|
|
|
+// GoString returns the string representation
|
|
|
+func (s RecordsEvent) GoString() string {
|
|
|
+ return s.String()
|
|
|
+}
|
|
|
+
|
|
|
+// SetPayload sets the Payload field's value.
|
|
|
+func (s *RecordsEvent) SetPayload(v []byte) *RecordsEvent {
|
|
|
+ s.Payload = v
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+// The RecordsEvent is and event in the SelectObjectContentEventStream group of events.
|
|
|
+func (s *RecordsEvent) eventSelectObjectContentEventStream() {}
|
|
|
+
|
|
|
+// UnmarshalEvent unmarshals the EventStream Message into the RecordsEvent value.
|
|
|
+// This method is only used internally within the SDK's EventStream handling.
|
|
|
+func (s *RecordsEvent) UnmarshalEvent(
|
|
|
+ payloadUnmarshaler protocol.PayloadUnmarshaler,
|
|
|
+ msg eventstream.Message,
|
|
|
+) error {
|
|
|
+ s.Payload = make([]byte, len(msg.Payload))
|
|
|
+ copy(s.Payload, msg.Payload)
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
type Redirect struct {
|
|
|
_ struct{} `type:"structure"`
|
|
|
|
|
|
@@ -18939,6 +19200,30 @@ func (s *RequestPaymentConfiguration) SetPayer(v string) *RequestPaymentConfigur
|
|
|
return s
|
|
|
}
|
|
|
|
|
|
+type RequestProgress struct {
|
|
|
+ _ struct{} `type:"structure"`
|
|
|
+
|
|
|
+ // Specifies whether periodic QueryProgress frames should be sent. Valid values:
|
|
|
+ // TRUE, FALSE. Default value: FALSE.
|
|
|
+ Enabled *bool `type:"boolean"`
|
|
|
+}
|
|
|
+
|
|
|
+// String returns the string representation
|
|
|
+func (s RequestProgress) String() string {
|
|
|
+ return awsutil.Prettify(s)
|
|
|
+}
|
|
|
+
|
|
|
+// GoString returns the string representation
|
|
|
+func (s RequestProgress) GoString() string {
|
|
|
+ return s.String()
|
|
|
+}
|
|
|
+
|
|
|
+// SetEnabled sets the Enabled field's value.
|
|
|
+func (s *RequestProgress) SetEnabled(v bool) *RequestProgress {
|
|
|
+ s.Enabled = &v
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
type RestoreObjectInput struct {
|
|
|
_ struct{} `type:"structure" payload:"RestoreRequest"`
|
|
|
|
|
|
@@ -19392,6 +19677,436 @@ func (s SSES3) GoString() string {
|
|
|
return s.String()
|
|
|
}
|
|
|
|
|
|
+// SelectObjectContentEventStream provides handling of EventStreams for
|
|
|
+// the SelectObjectContent API.
|
|
|
+//
|
|
|
+// Use this type to receive SelectObjectContentEventStream events. The events
|
|
|
+// can be read from the Events channel member.
|
|
|
+//
|
|
|
+// The events that can be received are:
|
|
|
+//
|
|
|
+// * ContinuationEvent
|
|
|
+// * EndEvent
|
|
|
+// * ProgressEvent
|
|
|
+// * RecordsEvent
|
|
|
+// * StatsEvent
|
|
|
+type SelectObjectContentEventStream struct {
|
|
|
+ // Reader is the EventStream reader for the SelectObjectContentEventStream
|
|
|
+ // events. This value is automatically set by the SDK when the API call is made
|
|
|
+ // Use this member when unit testing your code with the SDK to mock out the
|
|
|
+ // EventStream Reader.
|
|
|
+ //
|
|
|
+ // Must not be nil.
|
|
|
+ Reader SelectObjectContentEventStreamReader
|
|
|
+
|
|
|
+ // StreamCloser is the io.Closer for the EventStream connection. For HTTP
|
|
|
+ // EventStream this is the response Body. The stream will be closed when
|
|
|
+ // the Close method of the EventStream is called.
|
|
|
+ StreamCloser io.Closer
|
|
|
+}
|
|
|
+
|
|
|
+// Close closes the EventStream. This will also cause the Events channel to be
|
|
|
+// closed. You can use the closing of the Events channel to terminate your
|
|
|
+// application's read from the API's EventStream.
|
|
|
+//
|
|
|
+// Will close the underlying EventStream reader. For EventStream over HTTP
|
|
|
+// connection this will also close the HTTP connection.
|
|
|
+//
|
|
|
+// Close must be called when done using the EventStream API. Not calling Close
|
|
|
+// may result in resource leaks.
|
|
|
+func (es *SelectObjectContentEventStream) Close() (err error) {
|
|
|
+ es.Reader.Close()
|
|
|
+ return es.Err()
|
|
|
+}
|
|
|
+
|
|
|
+// Err returns any error that occurred while reading EventStream Events from
|
|
|
+// the service API's response. Returns nil if there were no errors.
|
|
|
+func (es *SelectObjectContentEventStream) Err() error {
|
|
|
+ if err := es.Reader.Err(); err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ es.StreamCloser.Close()
|
|
|
+
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+// Events returns a channel to read EventStream Events from the
|
|
|
+// SelectObjectContent API.
|
|
|
+//
|
|
|
+// These events are:
|
|
|
+//
|
|
|
+// * ContinuationEvent
|
|
|
+// * EndEvent
|
|
|
+// * ProgressEvent
|
|
|
+// * RecordsEvent
|
|
|
+// * StatsEvent
|
|
|
+func (es *SelectObjectContentEventStream) Events() <-chan SelectObjectContentEventStreamEvent {
|
|
|
+ return es.Reader.Events()
|
|
|
+}
|
|
|
+
|
|
|
+// SelectObjectContentEventStreamEvent groups together all EventStream
|
|
|
+// events read from the SelectObjectContent API.
|
|
|
+//
|
|
|
+// These events are:
|
|
|
+//
|
|
|
+// * ContinuationEvent
|
|
|
+// * EndEvent
|
|
|
+// * ProgressEvent
|
|
|
+// * RecordsEvent
|
|
|
+// * StatsEvent
|
|
|
+type SelectObjectContentEventStreamEvent interface {
|
|
|
+ eventSelectObjectContentEventStream()
|
|
|
+}
|
|
|
+
|
|
|
+// SelectObjectContentEventStreamReader provides the interface for reading EventStream
|
|
|
+// Events from the SelectObjectContent API. The
|
|
|
+// default implementation for this interface will be SelectObjectContentEventStream.
|
|
|
+//
|
|
|
+// The reader's Close method must allow multiple concurrent calls.
|
|
|
+//
|
|
|
+// These events are:
|
|
|
+//
|
|
|
+// * ContinuationEvent
|
|
|
+// * EndEvent
|
|
|
+// * ProgressEvent
|
|
|
+// * RecordsEvent
|
|
|
+// * StatsEvent
|
|
|
+type SelectObjectContentEventStreamReader interface {
|
|
|
+ // Returns a channel of events as they are read from the event stream.
|
|
|
+ Events() <-chan SelectObjectContentEventStreamEvent
|
|
|
+
|
|
|
+ // Close will close the underlying event stream reader. For event stream over
|
|
|
+ // HTTP this will also close the HTTP connection.
|
|
|
+ Close() error
|
|
|
+
|
|
|
+ // Returns any error that has occured while reading from the event stream.
|
|
|
+ Err() error
|
|
|
+}
|
|
|
+
|
|
|
+type readSelectObjectContentEventStream struct {
|
|
|
+ eventReader *eventstreamapi.EventReader
|
|
|
+ stream chan SelectObjectContentEventStreamEvent
|
|
|
+ errVal atomic.Value
|
|
|
+
|
|
|
+ done chan struct{}
|
|
|
+ closeOnce sync.Once
|
|
|
+}
|
|
|
+
|
|
|
+func newReadSelectObjectContentEventStream(
|
|
|
+ reader io.ReadCloser,
|
|
|
+ unmarshalers request.HandlerList,
|
|
|
+ logger aws.Logger,
|
|
|
+ logLevel aws.LogLevelType,
|
|
|
+) *readSelectObjectContentEventStream {
|
|
|
+ r := &readSelectObjectContentEventStream{
|
|
|
+ stream: make(chan SelectObjectContentEventStreamEvent),
|
|
|
+ done: make(chan struct{}),
|
|
|
+ }
|
|
|
+
|
|
|
+ r.eventReader = eventstreamapi.NewEventReader(
|
|
|
+ reader,
|
|
|
+ protocol.HandlerPayloadUnmarshal{
|
|
|
+ Unmarshalers: unmarshalers,
|
|
|
+ },
|
|
|
+ r.unmarshalerForEventType,
|
|
|
+ )
|
|
|
+ r.eventReader.UseLogger(logger, logLevel)
|
|
|
+
|
|
|
+ return r
|
|
|
+}
|
|
|
+
|
|
|
+// Close will close the underlying event stream reader. For EventStream over
|
|
|
+// HTTP this will also close the HTTP connection.
|
|
|
+func (r *readSelectObjectContentEventStream) Close() error {
|
|
|
+ r.closeOnce.Do(r.safeClose)
|
|
|
+
|
|
|
+ return r.Err()
|
|
|
+}
|
|
|
+
|
|
|
+func (r *readSelectObjectContentEventStream) safeClose() {
|
|
|
+ close(r.done)
|
|
|
+ err := r.eventReader.Close()
|
|
|
+ if err != nil {
|
|
|
+ r.errVal.Store(err)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+func (r *readSelectObjectContentEventStream) Err() error {
|
|
|
+ if v := r.errVal.Load(); v != nil {
|
|
|
+ return v.(error)
|
|
|
+ }
|
|
|
+
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+func (r *readSelectObjectContentEventStream) Events() <-chan SelectObjectContentEventStreamEvent {
|
|
|
+ return r.stream
|
|
|
+}
|
|
|
+
|
|
|
+func (r *readSelectObjectContentEventStream) readEventStream() {
|
|
|
+ defer close(r.stream)
|
|
|
+
|
|
|
+ for {
|
|
|
+ event, err := r.eventReader.ReadEvent()
|
|
|
+ if err != nil {
|
|
|
+ if err == io.EOF {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ select {
|
|
|
+ case <-r.done:
|
|
|
+ // If closed already ignore the error
|
|
|
+ return
|
|
|
+ default:
|
|
|
+ }
|
|
|
+ r.errVal.Store(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ select {
|
|
|
+ case r.stream <- event.(SelectObjectContentEventStreamEvent):
|
|
|
+ case <-r.done:
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+func (r *readSelectObjectContentEventStream) unmarshalerForEventType(
|
|
|
+ eventType string,
|
|
|
+) (eventstreamapi.Unmarshaler, error) {
|
|
|
+ switch eventType {
|
|
|
+ case "Cont":
|
|
|
+ return &ContinuationEvent{}, nil
|
|
|
+
|
|
|
+ case "End":
|
|
|
+ return &EndEvent{}, nil
|
|
|
+
|
|
|
+ case "Progress":
|
|
|
+ return &ProgressEvent{}, nil
|
|
|
+
|
|
|
+ case "Records":
|
|
|
+ return &RecordsEvent{}, nil
|
|
|
+
|
|
|
+ case "Stats":
|
|
|
+ return &StatsEvent{}, nil
|
|
|
+ default:
|
|
|
+ return nil, fmt.Errorf(
|
|
|
+ "unknown event type name, %s, for SelectObjectContentEventStream", eventType)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// Request to filter the contents of an Amazon S3 object based on a simple Structured
|
|
|
+// Query Language (SQL) statement. In the request, along with the SQL expression,
|
|
|
+// you must also specify a data serialization format (JSON or CSV) of the object.
|
|
|
+// Amazon S3 uses this to parse object data into records, and returns only records
|
|
|
+// that match the specified SQL expression. You must also specify the data serialization
|
|
|
+// format for the response. For more information, go to S3Select API Documentation
|
|
|
+// (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectSELECTContent.html)
|
|
|
+type SelectObjectContentInput struct {
|
|
|
+ _ struct{} `locationName:"SelectObjectContentRequest" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"`
|
|
|
+
|
|
|
+ // The S3 Bucket.
|
|
|
+ //
|
|
|
+ // Bucket is a required field
|
|
|
+ Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"`
|
|
|
+
|
|
|
+ // The expression that is used to query the object.
|
|
|
+ //
|
|
|
+ // Expression is a required field
|
|
|
+ Expression *string `type:"string" required:"true"`
|
|
|
+
|
|
|
+ // The type of the provided expression (e.g., SQL).
|
|
|
+ //
|
|
|
+ // ExpressionType is a required field
|
|
|
+ ExpressionType *string `type:"string" required:"true" enum:"ExpressionType"`
|
|
|
+
|
|
|
+ // Describes the format of the data in the object that is being queried.
|
|
|
+ //
|
|
|
+ // InputSerialization is a required field
|
|
|
+ InputSerialization *InputSerialization `type:"structure" required:"true"`
|
|
|
+
|
|
|
+ // The Object Key.
|
|
|
+ //
|
|
|
+ // Key is a required field
|
|
|
+ Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"`
|
|
|
+
|
|
|
+ // Describes the format of the data that you want Amazon S3 to return in response.
|
|
|
+ //
|
|
|
+ // OutputSerialization is a required field
|
|
|
+ OutputSerialization *OutputSerialization `type:"structure" required:"true"`
|
|
|
+
|
|
|
+ // Specifies if periodic request progress information should be enabled.
|
|
|
+ RequestProgress *RequestProgress `type:"structure"`
|
|
|
+
|
|
|
+ // The SSE Algorithm used to encrypt the object. For more information, go to
|
|
|
+ // Server-Side Encryption (Using Customer-Provided Encryption Keys (https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html)
|
|
|
+ SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"`
|
|
|
+
|
|
|
+ // The SSE Customer Key. For more information, go to Server-Side Encryption
|
|
|
+ // (Using Customer-Provided Encryption Keys (https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html)
|
|
|
+ SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string"`
|
|
|
+
|
|
|
+ // The SSE Customer Key MD5. For more information, go to Server-Side Encryption
|
|
|
+ // (Using Customer-Provided Encryption Keys (https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html)
|
|
|
+ SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"`
|
|
|
+}
|
|
|
+
|
|
|
+// String returns the string representation
|
|
|
+func (s SelectObjectContentInput) String() string {
|
|
|
+ return awsutil.Prettify(s)
|
|
|
+}
|
|
|
+
|
|
|
+// GoString returns the string representation
|
|
|
+func (s SelectObjectContentInput) GoString() string {
|
|
|
+ return s.String()
|
|
|
+}
|
|
|
+
|
|
|
+// Validate inspects the fields of the type to determine if they are valid.
|
|
|
+func (s *SelectObjectContentInput) Validate() error {
|
|
|
+ invalidParams := request.ErrInvalidParams{Context: "SelectObjectContentInput"}
|
|
|
+ if s.Bucket == nil {
|
|
|
+ invalidParams.Add(request.NewErrParamRequired("Bucket"))
|
|
|
+ }
|
|
|
+ if s.Expression == nil {
|
|
|
+ invalidParams.Add(request.NewErrParamRequired("Expression"))
|
|
|
+ }
|
|
|
+ if s.ExpressionType == nil {
|
|
|
+ invalidParams.Add(request.NewErrParamRequired("ExpressionType"))
|
|
|
+ }
|
|
|
+ if s.InputSerialization == nil {
|
|
|
+ invalidParams.Add(request.NewErrParamRequired("InputSerialization"))
|
|
|
+ }
|
|
|
+ if s.Key == nil {
|
|
|
+ invalidParams.Add(request.NewErrParamRequired("Key"))
|
|
|
+ }
|
|
|
+ if s.Key != nil && len(*s.Key) < 1 {
|
|
|
+ invalidParams.Add(request.NewErrParamMinLen("Key", 1))
|
|
|
+ }
|
|
|
+ if s.OutputSerialization == nil {
|
|
|
+ invalidParams.Add(request.NewErrParamRequired("OutputSerialization"))
|
|
|
+ }
|
|
|
+
|
|
|
+ if invalidParams.Len() > 0 {
|
|
|
+ return invalidParams
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetBucket sets the Bucket field's value.
|
|
|
+func (s *SelectObjectContentInput) SetBucket(v string) *SelectObjectContentInput {
|
|
|
+ s.Bucket = &v
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+func (s *SelectObjectContentInput) getBucket() (v string) {
|
|
|
+ if s.Bucket == nil {
|
|
|
+ return v
|
|
|
+ }
|
|
|
+ return *s.Bucket
|
|
|
+}
|
|
|
+
|
|
|
+// SetExpression sets the Expression field's value.
|
|
|
+func (s *SelectObjectContentInput) SetExpression(v string) *SelectObjectContentInput {
|
|
|
+ s.Expression = &v
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+// SetExpressionType sets the ExpressionType field's value.
|
|
|
+func (s *SelectObjectContentInput) SetExpressionType(v string) *SelectObjectContentInput {
|
|
|
+ s.ExpressionType = &v
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+// SetInputSerialization sets the InputSerialization field's value.
|
|
|
+func (s *SelectObjectContentInput) SetInputSerialization(v *InputSerialization) *SelectObjectContentInput {
|
|
|
+ s.InputSerialization = v
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+// SetKey sets the Key field's value.
|
|
|
+func (s *SelectObjectContentInput) SetKey(v string) *SelectObjectContentInput {
|
|
|
+ s.Key = &v
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+// SetOutputSerialization sets the OutputSerialization field's value.
|
|
|
+func (s *SelectObjectContentInput) SetOutputSerialization(v *OutputSerialization) *SelectObjectContentInput {
|
|
|
+ s.OutputSerialization = v
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+// SetRequestProgress sets the RequestProgress field's value.
|
|
|
+func (s *SelectObjectContentInput) SetRequestProgress(v *RequestProgress) *SelectObjectContentInput {
|
|
|
+ s.RequestProgress = v
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value.
|
|
|
+func (s *SelectObjectContentInput) SetSSECustomerAlgorithm(v string) *SelectObjectContentInput {
|
|
|
+ s.SSECustomerAlgorithm = &v
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+// SetSSECustomerKey sets the SSECustomerKey field's value.
|
|
|
+func (s *SelectObjectContentInput) SetSSECustomerKey(v string) *SelectObjectContentInput {
|
|
|
+ s.SSECustomerKey = &v
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+func (s *SelectObjectContentInput) getSSECustomerKey() (v string) {
|
|
|
+ if s.SSECustomerKey == nil {
|
|
|
+ return v
|
|
|
+ }
|
|
|
+ return *s.SSECustomerKey
|
|
|
+}
|
|
|
+
|
|
|
+// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value.
|
|
|
+func (s *SelectObjectContentInput) SetSSECustomerKeyMD5(v string) *SelectObjectContentInput {
|
|
|
+ s.SSECustomerKeyMD5 = &v
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+type SelectObjectContentOutput struct {
|
|
|
+ _ struct{} `type:"structure" payload:"Payload"`
|
|
|
+
|
|
|
+ // Use EventStream to use the API's stream.
|
|
|
+ EventStream *SelectObjectContentEventStream `type:"structure"`
|
|
|
+}
|
|
|
+
|
|
|
+// String returns the string representation
|
|
|
+func (s SelectObjectContentOutput) String() string {
|
|
|
+ return awsutil.Prettify(s)
|
|
|
+}
|
|
|
+
|
|
|
+// GoString returns the string representation
|
|
|
+func (s SelectObjectContentOutput) GoString() string {
|
|
|
+ return s.String()
|
|
|
+}
|
|
|
+
|
|
|
+// SetEventStream sets the EventStream field's value.
|
|
|
+func (s *SelectObjectContentOutput) SetEventStream(v *SelectObjectContentEventStream) *SelectObjectContentOutput {
|
|
|
+ s.EventStream = v
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+func (s *SelectObjectContentOutput) runEventStreamLoop(r *request.Request) {
|
|
|
+ if r.Error != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ reader := newReadSelectObjectContentEventStream(
|
|
|
+ r.HTTPResponse.Body,
|
|
|
+ r.Handlers.UnmarshalStream,
|
|
|
+ r.Config.Logger,
|
|
|
+ r.Config.LogLevel.Value(),
|
|
|
+ )
|
|
|
+ go reader.readEventStream()
|
|
|
+
|
|
|
+ eventStream := &SelectObjectContentEventStream{
|
|
|
+ StreamCloser: r.HTTPResponse.Body,
|
|
|
+ Reader: reader,
|
|
|
+ }
|
|
|
+ s.EventStream = eventStream
|
|
|
+}
|
|
|
+
|
|
|
// Describes the parameters for Select job types.
|
|
|
type SelectParameters struct {
|
|
|
_ struct{} `type:"structure"`
|
|
|
@@ -19696,6 +20411,87 @@ func (s *SseKmsEncryptedObjects) SetStatus(v string) *SseKmsEncryptedObjects {
|
|
|
return s
|
|
|
}
|
|
|
|
|
|
+type Stats struct {
|
|
|
+ _ struct{} `type:"structure"`
|
|
|
+
|
|
|
+ // Total number of uncompressed object bytes processed.
|
|
|
+ BytesProcessed *int64 `type:"long"`
|
|
|
+
|
|
|
+ // Total number of bytes of records payload data returned.
|
|
|
+ BytesReturned *int64 `type:"long"`
|
|
|
+
|
|
|
+ // Total number of object bytes scanned.
|
|
|
+ BytesScanned *int64 `type:"long"`
|
|
|
+}
|
|
|
+
|
|
|
+// String returns the string representation
|
|
|
+func (s Stats) String() string {
|
|
|
+ return awsutil.Prettify(s)
|
|
|
+}
|
|
|
+
|
|
|
+// GoString returns the string representation
|
|
|
+func (s Stats) GoString() string {
|
|
|
+ return s.String()
|
|
|
+}
|
|
|
+
|
|
|
+// SetBytesProcessed sets the BytesProcessed field's value.
|
|
|
+func (s *Stats) SetBytesProcessed(v int64) *Stats {
|
|
|
+ s.BytesProcessed = &v
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+// SetBytesReturned sets the BytesReturned field's value.
|
|
|
+func (s *Stats) SetBytesReturned(v int64) *Stats {
|
|
|
+ s.BytesReturned = &v
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+// SetBytesScanned sets the BytesScanned field's value.
|
|
|
+func (s *Stats) SetBytesScanned(v int64) *Stats {
|
|
|
+ s.BytesScanned = &v
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+type StatsEvent struct {
|
|
|
+ _ struct{} `type:"structure" payload:"Details"`
|
|
|
+
|
|
|
+ // The Stats event details.
|
|
|
+ Details *Stats `locationName:"Details" type:"structure"`
|
|
|
+}
|
|
|
+
|
|
|
+// String returns the string representation
|
|
|
+func (s StatsEvent) String() string {
|
|
|
+ return awsutil.Prettify(s)
|
|
|
+}
|
|
|
+
|
|
|
+// GoString returns the string representation
|
|
|
+func (s StatsEvent) GoString() string {
|
|
|
+ return s.String()
|
|
|
+}
|
|
|
+
|
|
|
+// SetDetails sets the Details field's value.
|
|
|
+func (s *StatsEvent) SetDetails(v *Stats) *StatsEvent {
|
|
|
+ s.Details = v
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+// The StatsEvent is and event in the SelectObjectContentEventStream group of events.
|
|
|
+func (s *StatsEvent) eventSelectObjectContentEventStream() {}
|
|
|
+
|
|
|
+// UnmarshalEvent unmarshals the EventStream Message into the StatsEvent value.
|
|
|
+// This method is only used internally within the SDK's EventStream handling.
|
|
|
+func (s *StatsEvent) UnmarshalEvent(
|
|
|
+ payloadUnmarshaler protocol.PayloadUnmarshaler,
|
|
|
+ msg eventstream.Message,
|
|
|
+) error {
|
|
|
+ if err := payloadUnmarshaler.UnmarshalPayload(
|
|
|
+ bytes.NewReader(msg.Payload), s,
|
|
|
+ ); err != nil {
|
|
|
+ return fmt.Errorf("failed to unmarshal payload, %v", err)
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
type StorageClassAnalysis struct {
|
|
|
_ struct{} `type:"structure"`
|
|
|
|