aws-sdk-cloudtraildata 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,118 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+ module Aws::CloudTrailData
11
+ # @api private
12
+ module ClientApi
13
+
14
+ include Seahorse::Model
15
+
16
+ AuditEvent = Shapes::StructureShape.new(name: 'AuditEvent')
17
+ AuditEventResultEntries = Shapes::ListShape.new(name: 'AuditEventResultEntries')
18
+ AuditEventResultEntry = Shapes::StructureShape.new(name: 'AuditEventResultEntry')
19
+ AuditEvents = Shapes::ListShape.new(name: 'AuditEvents')
20
+ ChannelArn = Shapes::StringShape.new(name: 'ChannelArn')
21
+ ChannelInsufficientPermission = Shapes::StructureShape.new(name: 'ChannelInsufficientPermission')
22
+ ChannelNotFound = Shapes::StructureShape.new(name: 'ChannelNotFound')
23
+ ChannelUnsupportedSchema = Shapes::StructureShape.new(name: 'ChannelUnsupportedSchema')
24
+ DuplicatedAuditEventId = Shapes::StructureShape.new(name: 'DuplicatedAuditEventId')
25
+ ErrorCode = Shapes::StringShape.new(name: 'ErrorCode')
26
+ ErrorMessage = Shapes::StringShape.new(name: 'ErrorMessage')
27
+ ExternalId = Shapes::StringShape.new(name: 'ExternalId')
28
+ InvalidChannelARN = Shapes::StructureShape.new(name: 'InvalidChannelARN')
29
+ PutAuditEventsRequest = Shapes::StructureShape.new(name: 'PutAuditEventsRequest')
30
+ PutAuditEventsResponse = Shapes::StructureShape.new(name: 'PutAuditEventsResponse')
31
+ ResultErrorEntries = Shapes::ListShape.new(name: 'ResultErrorEntries')
32
+ ResultErrorEntry = Shapes::StructureShape.new(name: 'ResultErrorEntry')
33
+ String = Shapes::StringShape.new(name: 'String')
34
+ UnsupportedOperationException = Shapes::StructureShape.new(name: 'UnsupportedOperationException')
35
+ Uuid = Shapes::StringShape.new(name: 'Uuid')
36
+
37
+ AuditEvent.add_member(:event_data, Shapes::ShapeRef.new(shape: String, required: true, location_name: "eventData"))
38
+ AuditEvent.add_member(:event_data_checksum, Shapes::ShapeRef.new(shape: String, location_name: "eventDataChecksum"))
39
+ AuditEvent.add_member(:id, Shapes::ShapeRef.new(shape: Uuid, required: true, location_name: "id"))
40
+ AuditEvent.struct_class = Types::AuditEvent
41
+
42
+ AuditEventResultEntries.member = Shapes::ShapeRef.new(shape: AuditEventResultEntry)
43
+
44
+ AuditEventResultEntry.add_member(:event_id, Shapes::ShapeRef.new(shape: Uuid, required: true, location_name: "eventID"))
45
+ AuditEventResultEntry.add_member(:id, Shapes::ShapeRef.new(shape: Uuid, required: true, location_name: "id"))
46
+ AuditEventResultEntry.struct_class = Types::AuditEventResultEntry
47
+
48
+ AuditEvents.member = Shapes::ShapeRef.new(shape: AuditEvent)
49
+
50
+ ChannelInsufficientPermission.add_member(:message, Shapes::ShapeRef.new(shape: String, location_name: "message"))
51
+ ChannelInsufficientPermission.struct_class = Types::ChannelInsufficientPermission
52
+
53
+ ChannelNotFound.add_member(:message, Shapes::ShapeRef.new(shape: String, location_name: "message"))
54
+ ChannelNotFound.struct_class = Types::ChannelNotFound
55
+
56
+ ChannelUnsupportedSchema.add_member(:message, Shapes::ShapeRef.new(shape: String, location_name: "message"))
57
+ ChannelUnsupportedSchema.struct_class = Types::ChannelUnsupportedSchema
58
+
59
+ DuplicatedAuditEventId.add_member(:message, Shapes::ShapeRef.new(shape: String, location_name: "message"))
60
+ DuplicatedAuditEventId.struct_class = Types::DuplicatedAuditEventId
61
+
62
+ InvalidChannelARN.add_member(:message, Shapes::ShapeRef.new(shape: String, location_name: "message"))
63
+ InvalidChannelARN.struct_class = Types::InvalidChannelARN
64
+
65
+ PutAuditEventsRequest.add_member(:audit_events, Shapes::ShapeRef.new(shape: AuditEvents, required: true, location_name: "auditEvents"))
66
+ PutAuditEventsRequest.add_member(:channel_arn, Shapes::ShapeRef.new(shape: ChannelArn, required: true, location: "querystring", location_name: "channelArn"))
67
+ PutAuditEventsRequest.add_member(:external_id, Shapes::ShapeRef.new(shape: ExternalId, location: "querystring", location_name: "externalId"))
68
+ PutAuditEventsRequest.struct_class = Types::PutAuditEventsRequest
69
+
70
+ PutAuditEventsResponse.add_member(:failed, Shapes::ShapeRef.new(shape: ResultErrorEntries, required: true, location_name: "failed"))
71
+ PutAuditEventsResponse.add_member(:successful, Shapes::ShapeRef.new(shape: AuditEventResultEntries, required: true, location_name: "successful"))
72
+ PutAuditEventsResponse.struct_class = Types::PutAuditEventsResponse
73
+
74
+ ResultErrorEntries.member = Shapes::ShapeRef.new(shape: ResultErrorEntry)
75
+
76
+ ResultErrorEntry.add_member(:error_code, Shapes::ShapeRef.new(shape: ErrorCode, required: true, location_name: "errorCode"))
77
+ ResultErrorEntry.add_member(:error_message, Shapes::ShapeRef.new(shape: ErrorMessage, required: true, location_name: "errorMessage"))
78
+ ResultErrorEntry.add_member(:id, Shapes::ShapeRef.new(shape: Uuid, required: true, location_name: "id"))
79
+ ResultErrorEntry.struct_class = Types::ResultErrorEntry
80
+
81
+ UnsupportedOperationException.add_member(:message, Shapes::ShapeRef.new(shape: String, location_name: "message"))
82
+ UnsupportedOperationException.struct_class = Types::UnsupportedOperationException
83
+
84
+
85
+ # @api private
86
+ API = Seahorse::Model::Api.new.tap do |api|
87
+
88
+ api.version = "2021-08-11"
89
+
90
+ api.metadata = {
91
+ "apiVersion" => "2021-08-11",
92
+ "endpointPrefix" => "cloudtrail-data",
93
+ "jsonVersion" => "1.1",
94
+ "protocol" => "rest-json",
95
+ "serviceFullName" => "AWS CloudTrail Data Service",
96
+ "serviceId" => "CloudTrail Data",
97
+ "signatureVersion" => "v4",
98
+ "signingName" => "cloudtrail-data",
99
+ "uid" => "cloudtrail-data-2021-08-11",
100
+ }
101
+
102
+ api.add_operation(:put_audit_events, Seahorse::Model::Operation.new.tap do |o|
103
+ o.name = "PutAuditEvents"
104
+ o.http_method = "POST"
105
+ o.http_request_uri = "/PutAuditEvents"
106
+ o.input = Shapes::ShapeRef.new(shape: PutAuditEventsRequest)
107
+ o.output = Shapes::ShapeRef.new(shape: PutAuditEventsResponse)
108
+ o.errors << Shapes::ShapeRef.new(shape: ChannelInsufficientPermission)
109
+ o.errors << Shapes::ShapeRef.new(shape: ChannelNotFound)
110
+ o.errors << Shapes::ShapeRef.new(shape: InvalidChannelARN)
111
+ o.errors << Shapes::ShapeRef.new(shape: ChannelUnsupportedSchema)
112
+ o.errors << Shapes::ShapeRef.new(shape: DuplicatedAuditEventId)
113
+ o.errors << Shapes::ShapeRef.new(shape: UnsupportedOperationException)
114
+ end)
115
+ end
116
+
117
+ end
118
+ end
File without changes
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+ module Aws::CloudTrailData
11
+ # Endpoint parameters used to influence endpoints per request.
12
+ #
13
+ # @!attribute region
14
+ # The AWS region used to dispatch the request.
15
+ #
16
+ # @return [String]
17
+ #
18
+ # @!attribute use_dual_stack
19
+ # When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
20
+ #
21
+ # @return [Boolean]
22
+ #
23
+ # @!attribute use_fips
24
+ # When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.
25
+ #
26
+ # @return [Boolean]
27
+ #
28
+ # @!attribute endpoint
29
+ # Override the endpoint used to send this request
30
+ #
31
+ # @return [String]
32
+ #
33
+ EndpointParameters = Struct.new(
34
+ :region,
35
+ :use_dual_stack,
36
+ :use_fips,
37
+ :endpoint,
38
+ ) do
39
+ include Aws::Structure
40
+
41
+ # @api private
42
+ class << self
43
+ PARAM_MAP = {
44
+ 'Region' => :region,
45
+ 'UseDualStack' => :use_dual_stack,
46
+ 'UseFIPS' => :use_fips,
47
+ 'Endpoint' => :endpoint,
48
+ }.freeze
49
+ end
50
+
51
+ def initialize(options = {})
52
+ self[:region] = options[:region]
53
+ if self[:region].nil?
54
+ raise ArgumentError, "Missing required EndpointParameter: :region"
55
+ end
56
+ self[:use_dual_stack] = options[:use_dual_stack]
57
+ self[:use_dual_stack] = false if self[:use_dual_stack].nil?
58
+ if self[:use_dual_stack].nil?
59
+ raise ArgumentError, "Missing required EndpointParameter: :use_dual_stack"
60
+ end
61
+ self[:use_fips] = options[:use_fips]
62
+ self[:use_fips] = false if self[:use_fips].nil?
63
+ if self[:use_fips].nil?
64
+ raise ArgumentError, "Missing required EndpointParameter: :use_fips"
65
+ end
66
+ self[:endpoint] = options[:endpoint]
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+ module Aws::CloudTrailData
11
+ class EndpointProvider
12
+ def resolve_endpoint(parameters)
13
+ region = parameters.region
14
+ use_dual_stack = parameters.use_dual_stack
15
+ use_fips = parameters.use_fips
16
+ endpoint = parameters.endpoint
17
+ if (partition_result = Aws::Endpoints::Matchers.aws_partition(region))
18
+ if Aws::Endpoints::Matchers.set?(endpoint)
19
+ if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)
20
+ raise ArgumentError, "Invalid Configuration: FIPS and custom endpoint are not supported"
21
+ end
22
+ if Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
23
+ raise ArgumentError, "Invalid Configuration: Dualstack and custom endpoint are not supported"
24
+ end
25
+ return Aws::Endpoints::Endpoint.new(url: endpoint, headers: {}, properties: {})
26
+ end
27
+ if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true) && Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
28
+ if Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsFIPS")) && Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsDualStack"))
29
+ return Aws::Endpoints::Endpoint.new(url: "https://cloudtrail-data-fips.#{region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
30
+ end
31
+ raise ArgumentError, "FIPS and DualStack are enabled, but this partition does not support one or both"
32
+ end
33
+ if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)
34
+ if Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsFIPS"))
35
+ return Aws::Endpoints::Endpoint.new(url: "https://cloudtrail-data-fips.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
36
+ end
37
+ raise ArgumentError, "FIPS is enabled but this partition does not support FIPS"
38
+ end
39
+ if Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
40
+ if Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsDualStack"))
41
+ return Aws::Endpoints::Endpoint.new(url: "https://cloudtrail-data.#{region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
42
+ end
43
+ raise ArgumentError, "DualStack is enabled but this partition does not support DualStack"
44
+ end
45
+ return Aws::Endpoints::Endpoint.new(url: "https://cloudtrail-data.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
46
+ end
47
+ raise ArgumentError, 'No endpoint could be resolved'
48
+
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+
11
+ module Aws::CloudTrailData
12
+ module Endpoints
13
+
14
+ class PutAuditEvents
15
+ def self.build(context)
16
+ unless context.config.regional_endpoint
17
+ endpoint = context.config.endpoint.to_s
18
+ end
19
+ Aws::CloudTrailData::EndpointParameters.new(
20
+ region: context.config.region,
21
+ use_dual_stack: context.config.use_dualstack_endpoint,
22
+ use_fips: context.config.use_fips_endpoint,
23
+ endpoint: endpoint,
24
+ )
25
+ end
26
+ end
27
+
28
+ end
29
+ end
@@ -0,0 +1,134 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+ module Aws::CloudTrailData
11
+
12
+ # When CloudTrailData returns an error response, the Ruby SDK constructs and raises an error.
13
+ # These errors all extend Aws::CloudTrailData::Errors::ServiceError < {Aws::Errors::ServiceError}
14
+ #
15
+ # You can rescue all CloudTrailData errors using ServiceError:
16
+ #
17
+ # begin
18
+ # # do stuff
19
+ # rescue Aws::CloudTrailData::Errors::ServiceError
20
+ # # rescues all CloudTrailData API errors
21
+ # end
22
+ #
23
+ #
24
+ # ## Request Context
25
+ # ServiceError objects have a {Aws::Errors::ServiceError#context #context} method that returns
26
+ # information about the request that generated the error.
27
+ # See {Seahorse::Client::RequestContext} for more information.
28
+ #
29
+ # ## Error Classes
30
+ # * {ChannelInsufficientPermission}
31
+ # * {ChannelNotFound}
32
+ # * {ChannelUnsupportedSchema}
33
+ # * {DuplicatedAuditEventId}
34
+ # * {InvalidChannelARN}
35
+ # * {UnsupportedOperationException}
36
+ #
37
+ # Additionally, error classes are dynamically generated for service errors based on the error code
38
+ # if they are not defined above.
39
+ module Errors
40
+
41
+ extend Aws::Errors::DynamicErrors
42
+
43
+ class ChannelInsufficientPermission < ServiceError
44
+
45
+ # @param [Seahorse::Client::RequestContext] context
46
+ # @param [String] message
47
+ # @param [Aws::CloudTrailData::Types::ChannelInsufficientPermission] data
48
+ def initialize(context, message, data = Aws::EmptyStructure.new)
49
+ super(context, message, data)
50
+ end
51
+
52
+ # @return [String]
53
+ def message
54
+ @message || @data[:message]
55
+ end
56
+ end
57
+
58
+ class ChannelNotFound < ServiceError
59
+
60
+ # @param [Seahorse::Client::RequestContext] context
61
+ # @param [String] message
62
+ # @param [Aws::CloudTrailData::Types::ChannelNotFound] data
63
+ def initialize(context, message, data = Aws::EmptyStructure.new)
64
+ super(context, message, data)
65
+ end
66
+
67
+ # @return [String]
68
+ def message
69
+ @message || @data[:message]
70
+ end
71
+ end
72
+
73
+ class ChannelUnsupportedSchema < ServiceError
74
+
75
+ # @param [Seahorse::Client::RequestContext] context
76
+ # @param [String] message
77
+ # @param [Aws::CloudTrailData::Types::ChannelUnsupportedSchema] data
78
+ def initialize(context, message, data = Aws::EmptyStructure.new)
79
+ super(context, message, data)
80
+ end
81
+
82
+ # @return [String]
83
+ def message
84
+ @message || @data[:message]
85
+ end
86
+ end
87
+
88
+ class DuplicatedAuditEventId < ServiceError
89
+
90
+ # @param [Seahorse::Client::RequestContext] context
91
+ # @param [String] message
92
+ # @param [Aws::CloudTrailData::Types::DuplicatedAuditEventId] data
93
+ def initialize(context, message, data = Aws::EmptyStructure.new)
94
+ super(context, message, data)
95
+ end
96
+
97
+ # @return [String]
98
+ def message
99
+ @message || @data[:message]
100
+ end
101
+ end
102
+
103
+ class InvalidChannelARN < ServiceError
104
+
105
+ # @param [Seahorse::Client::RequestContext] context
106
+ # @param [String] message
107
+ # @param [Aws::CloudTrailData::Types::InvalidChannelARN] data
108
+ def initialize(context, message, data = Aws::EmptyStructure.new)
109
+ super(context, message, data)
110
+ end
111
+
112
+ # @return [String]
113
+ def message
114
+ @message || @data[:message]
115
+ end
116
+ end
117
+
118
+ class UnsupportedOperationException < ServiceError
119
+
120
+ # @param [Seahorse::Client::RequestContext] context
121
+ # @param [String] message
122
+ # @param [Aws::CloudTrailData::Types::UnsupportedOperationException] data
123
+ def initialize(context, message, data = Aws::EmptyStructure.new)
124
+ super(context, message, data)
125
+ end
126
+
127
+ # @return [String]
128
+ def message
129
+ @message || @data[:message]
130
+ end
131
+ end
132
+
133
+ end
134
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+
11
+ module Aws::CloudTrailData
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::CloudTrailData::EndpointProvider',
17
+ docstring: 'The endpoint provider used to resolve endpoints. Any '\
18
+ 'object that responds to `#resolve_endpoint(parameters)` '\
19
+ 'where `parameters` is a Struct similar to '\
20
+ '`Aws::CloudTrailData::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::CloudTrailData::EndpointProvider.new
23
+ end
24
+
25
+ # @api private
26
+ class Handler < Seahorse::Client::Handler
27
+ def call(context)
28
+ # If endpoint was discovered, do not resolve or apply the endpoint.
29
+ unless context[:discovered_endpoint]
30
+ params = parameters_for_operation(context)
31
+ endpoint = context.config.endpoint_provider.resolve_endpoint(params)
32
+
33
+ context.http_request.endpoint = endpoint.url
34
+ apply_endpoint_headers(context, endpoint.headers)
35
+ end
36
+
37
+ context[:endpoint_params] = params
38
+ context[:auth_scheme] =
39
+ Aws::Endpoints.resolve_auth_scheme(context, endpoint)
40
+
41
+ @handler.call(context)
42
+ end
43
+
44
+ private
45
+
46
+ def apply_endpoint_headers(context, headers)
47
+ headers.each do |key, values|
48
+ value = values
49
+ .compact
50
+ .map { |s| Seahorse::Util.escape_header_list_string(s.to_s) }
51
+ .join(',')
52
+
53
+ context.http_request.headers[key] = value
54
+ end
55
+ end
56
+
57
+ def parameters_for_operation(context)
58
+ case context.operation_name
59
+ when :put_audit_events
60
+ Aws::CloudTrailData::Endpoints::PutAuditEvents.build(context)
61
+ end
62
+ end
63
+ end
64
+
65
+ def add_handlers(handlers, _config)
66
+ handlers.add(Handler, step: :build, priority: 75)
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+ module Aws::CloudTrailData
11
+
12
+ class Resource
13
+
14
+ # @param options ({})
15
+ # @option options [Client] :client
16
+ def initialize(options = {})
17
+ @client = options[:client] || Client.new(options)
18
+ end
19
+
20
+ # @return [Client]
21
+ def client
22
+ @client
23
+ end
24
+
25
+ end
26
+ end