aws-sdk-bcmrecommendedactions 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,145 @@
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::BCMRecommendedActions
12
+ # @api private
13
+ module ClientApi
14
+
15
+ include Seahorse::Model
16
+
17
+ AccessDeniedException = Shapes::StructureShape.new(name: 'AccessDeniedException')
18
+ AccountId = Shapes::StringShape.new(name: 'AccountId')
19
+ ActionFilter = Shapes::StructureShape.new(name: 'ActionFilter')
20
+ ActionFilterList = Shapes::ListShape.new(name: 'ActionFilterList')
21
+ ActionType = Shapes::StringShape.new(name: 'ActionType')
22
+ Context = Shapes::MapShape.new(name: 'Context')
23
+ Feature = Shapes::StringShape.new(name: 'Feature')
24
+ FilterName = Shapes::StringShape.new(name: 'FilterName')
25
+ FilterValue = Shapes::StringShape.new(name: 'FilterValue')
26
+ FilterValues = Shapes::ListShape.new(name: 'FilterValues')
27
+ InternalServerException = Shapes::StructureShape.new(name: 'InternalServerException')
28
+ ListRecommendedActionsRequest = Shapes::StructureShape.new(name: 'ListRecommendedActionsRequest')
29
+ ListRecommendedActionsResponse = Shapes::StructureShape.new(name: 'ListRecommendedActionsResponse')
30
+ MatchOption = Shapes::StringShape.new(name: 'MatchOption')
31
+ MaxResults = Shapes::IntegerShape.new(name: 'MaxResults')
32
+ NextStep = Shapes::StringShape.new(name: 'NextStep')
33
+ NextSteps = Shapes::ListShape.new(name: 'NextSteps')
34
+ NextToken = Shapes::StringShape.new(name: 'NextToken')
35
+ RecommendedAction = Shapes::StructureShape.new(name: 'RecommendedAction')
36
+ RecommendedActions = Shapes::ListShape.new(name: 'RecommendedActions')
37
+ RequestFilter = Shapes::StructureShape.new(name: 'RequestFilter')
38
+ Severity = Shapes::StringShape.new(name: 'Severity')
39
+ String = Shapes::StringShape.new(name: 'String')
40
+ ThrottlingException = Shapes::StructureShape.new(name: 'ThrottlingException')
41
+ ValidationException = Shapes::StructureShape.new(name: 'ValidationException')
42
+ ValidationExceptionField = Shapes::StructureShape.new(name: 'ValidationExceptionField')
43
+ ValidationExceptionFieldList = Shapes::ListShape.new(name: 'ValidationExceptionFieldList')
44
+ ValidationExceptionReason = Shapes::StringShape.new(name: 'ValidationExceptionReason')
45
+
46
+ AccessDeniedException.add_member(:message, Shapes::ShapeRef.new(shape: String, required: true, location_name: "message"))
47
+ AccessDeniedException.struct_class = Types::AccessDeniedException
48
+
49
+ ActionFilter.add_member(:key, Shapes::ShapeRef.new(shape: FilterName, required: true, location_name: "key"))
50
+ ActionFilter.add_member(:match_option, Shapes::ShapeRef.new(shape: MatchOption, required: true, location_name: "matchOption"))
51
+ ActionFilter.add_member(:values, Shapes::ShapeRef.new(shape: FilterValues, required: true, location_name: "values"))
52
+ ActionFilter.struct_class = Types::ActionFilter
53
+
54
+ ActionFilterList.member = Shapes::ShapeRef.new(shape: ActionFilter)
55
+
56
+ Context.key = Shapes::ShapeRef.new(shape: String)
57
+ Context.value = Shapes::ShapeRef.new(shape: String)
58
+
59
+ FilterValues.member = Shapes::ShapeRef.new(shape: FilterValue)
60
+
61
+ InternalServerException.add_member(:message, Shapes::ShapeRef.new(shape: String, required: true, location_name: "message"))
62
+ InternalServerException.struct_class = Types::InternalServerException
63
+
64
+ ListRecommendedActionsRequest.add_member(:filter, Shapes::ShapeRef.new(shape: RequestFilter, location_name: "filter"))
65
+ ListRecommendedActionsRequest.add_member(:max_results, Shapes::ShapeRef.new(shape: MaxResults, location_name: "maxResults"))
66
+ ListRecommendedActionsRequest.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "nextToken"))
67
+ ListRecommendedActionsRequest.struct_class = Types::ListRecommendedActionsRequest
68
+
69
+ ListRecommendedActionsResponse.add_member(:recommended_actions, Shapes::ShapeRef.new(shape: RecommendedActions, required: true, location_name: "recommendedActions"))
70
+ ListRecommendedActionsResponse.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "nextToken"))
71
+ ListRecommendedActionsResponse.struct_class = Types::ListRecommendedActionsResponse
72
+
73
+ NextSteps.member = Shapes::ShapeRef.new(shape: NextStep)
74
+
75
+ RecommendedAction.add_member(:id, Shapes::ShapeRef.new(shape: String, location_name: "id"))
76
+ RecommendedAction.add_member(:type, Shapes::ShapeRef.new(shape: ActionType, location_name: "type"))
77
+ RecommendedAction.add_member(:account_id, Shapes::ShapeRef.new(shape: AccountId, location_name: "accountId"))
78
+ RecommendedAction.add_member(:severity, Shapes::ShapeRef.new(shape: Severity, location_name: "severity"))
79
+ RecommendedAction.add_member(:feature, Shapes::ShapeRef.new(shape: Feature, location_name: "feature"))
80
+ RecommendedAction.add_member(:context, Shapes::ShapeRef.new(shape: Context, location_name: "context"))
81
+ RecommendedAction.add_member(:next_steps, Shapes::ShapeRef.new(shape: NextSteps, location_name: "nextSteps"))
82
+ RecommendedAction.add_member(:last_updated_time_stamp, Shapes::ShapeRef.new(shape: String, location_name: "lastUpdatedTimeStamp"))
83
+ RecommendedAction.struct_class = Types::RecommendedAction
84
+
85
+ RecommendedActions.member = Shapes::ShapeRef.new(shape: RecommendedAction)
86
+
87
+ RequestFilter.add_member(:actions, Shapes::ShapeRef.new(shape: ActionFilterList, location_name: "actions"))
88
+ RequestFilter.struct_class = Types::RequestFilter
89
+
90
+ ThrottlingException.add_member(:message, Shapes::ShapeRef.new(shape: String, required: true, location_name: "message"))
91
+ ThrottlingException.struct_class = Types::ThrottlingException
92
+
93
+ ValidationException.add_member(:message, Shapes::ShapeRef.new(shape: String, required: true, location_name: "message"))
94
+ ValidationException.add_member(:reason, Shapes::ShapeRef.new(shape: ValidationExceptionReason, required: true, location_name: "reason"))
95
+ ValidationException.add_member(:field_list, Shapes::ShapeRef.new(shape: ValidationExceptionFieldList, location_name: "fieldList"))
96
+ ValidationException.struct_class = Types::ValidationException
97
+
98
+ ValidationExceptionField.add_member(:name, Shapes::ShapeRef.new(shape: String, required: true, location_name: "name"))
99
+ ValidationExceptionField.add_member(:message, Shapes::ShapeRef.new(shape: String, required: true, location_name: "message"))
100
+ ValidationExceptionField.struct_class = Types::ValidationExceptionField
101
+
102
+ ValidationExceptionFieldList.member = Shapes::ShapeRef.new(shape: ValidationExceptionField)
103
+
104
+
105
+ # @api private
106
+ API = Seahorse::Model::Api.new.tap do |api|
107
+
108
+ api.version = "2024-11-14"
109
+
110
+ api.metadata = {
111
+ "apiVersion" => "2024-11-14",
112
+ "auth" => ["aws.auth#sigv4"],
113
+ "endpointPrefix" => "bcm-recommended-actions",
114
+ "jsonVersion" => "1.0",
115
+ "protocol" => "json",
116
+ "protocols" => ["json"],
117
+ "serviceFullName" => "AWS Billing and Cost Management Recommended Actions",
118
+ "serviceId" => "BCM Recommended Actions",
119
+ "signatureVersion" => "v4",
120
+ "signingName" => "bcm-recommended-actions",
121
+ "targetPrefix" => "AWSBillingAndCostManagementRecommendedActions",
122
+ "uid" => "bcm-recommended-actions-2024-11-14",
123
+ }
124
+
125
+ api.add_operation(:list_recommended_actions, Seahorse::Model::Operation.new.tap do |o|
126
+ o.name = "ListRecommendedActions"
127
+ o.http_method = "POST"
128
+ o.http_request_uri = "/"
129
+ o.input = Shapes::ShapeRef.new(shape: ListRecommendedActionsRequest)
130
+ o.output = Shapes::ShapeRef.new(shape: ListRecommendedActionsResponse)
131
+ o.errors << Shapes::ShapeRef.new(shape: AccessDeniedException)
132
+ o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
133
+ o.errors << Shapes::ShapeRef.new(shape: ValidationException)
134
+ o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
135
+ o[:pager] = Aws::Pager.new(
136
+ limit_key: "max_results",
137
+ tokens: {
138
+ "next_token" => "next_token"
139
+ }
140
+ )
141
+ end)
142
+ end
143
+
144
+ end
145
+ end
@@ -0,0 +1,59 @@
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::BCMRecommendedActions
11
+ # Endpoint parameters used to influence endpoints per request.
12
+ #
13
+ # @!attribute use_fips
14
+ # 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.
15
+ #
16
+ # @return [Boolean]
17
+ #
18
+ # @!attribute endpoint
19
+ # Override the endpoint used to send this request
20
+ #
21
+ # @return [String]
22
+ #
23
+ # @!attribute region
24
+ # The AWS region used to dispatch the request.
25
+ #
26
+ # @return [String]
27
+ #
28
+ EndpointParameters = Struct.new(
29
+ :use_fips,
30
+ :endpoint,
31
+ :region,
32
+ ) do
33
+ include Aws::Structure
34
+
35
+ # @api private
36
+ class << self
37
+ PARAM_MAP = {
38
+ 'UseFIPS' => :use_fips,
39
+ 'Endpoint' => :endpoint,
40
+ 'Region' => :region,
41
+ }.freeze
42
+ end
43
+
44
+ def initialize(options = {})
45
+ self[:use_fips] = options[:use_fips]
46
+ self[:use_fips] = false if self[:use_fips].nil?
47
+ self[:endpoint] = options[:endpoint]
48
+ self[:region] = options[:region]
49
+ end
50
+
51
+ def self.create(config, options={})
52
+ new({
53
+ use_fips: config.use_fips_endpoint,
54
+ endpoint: (config.endpoint.to_s unless config.regional_endpoint),
55
+ region: config.region,
56
+ }.merge(options))
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,32 @@
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::BCMRecommendedActions
11
+ class EndpointProvider
12
+ def resolve_endpoint(parameters)
13
+ if Aws::Endpoints::Matchers.set?(parameters.endpoint)
14
+ if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_fips, true)
15
+ raise ArgumentError, "Invalid Configuration: FIPS and custom endpoint are not supported"
16
+ end
17
+ return Aws::Endpoints::Endpoint.new(url: parameters.endpoint, headers: {}, properties: {})
18
+ end
19
+ if Aws::Endpoints::Matchers.set?(parameters.region)
20
+ if (partition_result = Aws::Endpoints::Matchers.aws_partition(parameters.region))
21
+ if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_fips, true)
22
+ return Aws::Endpoints::Endpoint.new(url: "https://bcm-recommended-actions-fips.#{partition_result['implicitGlobalRegion']}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {"authSchemes" => [{"name" => "sigv4", "signingRegion" => "#{partition_result['implicitGlobalRegion']}"}]})
23
+ end
24
+ return Aws::Endpoints::Endpoint.new(url: "https://bcm-recommended-actions.#{partition_result['implicitGlobalRegion']}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {"authSchemes" => [{"name" => "sigv4", "signingRegion" => "#{partition_result['implicitGlobalRegion']}"}]})
25
+ end
26
+ end
27
+ raise ArgumentError, "Invalid Configuration: Missing Region"
28
+ raise ArgumentError, 'No endpoint could be resolved'
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,20 @@
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::BCMRecommendedActions
12
+ # @api private
13
+ module Endpoints
14
+
15
+
16
+ def self.parameters_for_operation(context)
17
+ Aws::BCMRecommendedActions::EndpointParameters.create(context.config)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,112 @@
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::BCMRecommendedActions
11
+
12
+ # When BCMRecommendedActions returns an error response, the Ruby SDK constructs and raises an error.
13
+ # These errors all extend Aws::BCMRecommendedActions::Errors::ServiceError < {Aws::Errors::ServiceError}
14
+ #
15
+ # You can rescue all BCMRecommendedActions errors using ServiceError:
16
+ #
17
+ # begin
18
+ # # do stuff
19
+ # rescue Aws::BCMRecommendedActions::Errors::ServiceError
20
+ # # rescues all BCMRecommendedActions 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
+ # * {AccessDeniedException}
31
+ # * {InternalServerException}
32
+ # * {ThrottlingException}
33
+ # * {ValidationException}
34
+ #
35
+ # Additionally, error classes are dynamically generated for service errors based on the error code
36
+ # if they are not defined above.
37
+ module Errors
38
+
39
+ extend Aws::Errors::DynamicErrors
40
+
41
+ class AccessDeniedException < ServiceError
42
+
43
+ # @param [Seahorse::Client::RequestContext] context
44
+ # @param [String] message
45
+ # @param [Aws::BCMRecommendedActions::Types::AccessDeniedException] data
46
+ def initialize(context, message, data = Aws::EmptyStructure.new)
47
+ super(context, message, data)
48
+ end
49
+
50
+ # @return [String]
51
+ def message
52
+ @message || @data[:message]
53
+ end
54
+ end
55
+
56
+ class InternalServerException < ServiceError
57
+
58
+ # @param [Seahorse::Client::RequestContext] context
59
+ # @param [String] message
60
+ # @param [Aws::BCMRecommendedActions::Types::InternalServerException] data
61
+ def initialize(context, message, data = Aws::EmptyStructure.new)
62
+ super(context, message, data)
63
+ end
64
+
65
+ # @return [String]
66
+ def message
67
+ @message || @data[:message]
68
+ end
69
+ end
70
+
71
+ class ThrottlingException < ServiceError
72
+
73
+ # @param [Seahorse::Client::RequestContext] context
74
+ # @param [String] message
75
+ # @param [Aws::BCMRecommendedActions::Types::ThrottlingException] data
76
+ def initialize(context, message, data = Aws::EmptyStructure.new)
77
+ super(context, message, data)
78
+ end
79
+
80
+ # @return [String]
81
+ def message
82
+ @message || @data[:message]
83
+ end
84
+ end
85
+
86
+ class ValidationException < ServiceError
87
+
88
+ # @param [Seahorse::Client::RequestContext] context
89
+ # @param [String] message
90
+ # @param [Aws::BCMRecommendedActions::Types::ValidationException] data
91
+ def initialize(context, message, data = Aws::EmptyStructure.new)
92
+ super(context, message, data)
93
+ end
94
+
95
+ # @return [String]
96
+ def message
97
+ @message || @data[:message]
98
+ end
99
+
100
+ # @return [String]
101
+ def reason
102
+ @data[:reason]
103
+ end
104
+
105
+ # @return [String]
106
+ def field_list
107
+ @data[:field_list]
108
+ end
109
+ end
110
+
111
+ end
112
+ end
@@ -0,0 +1,77 @@
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::BCMRecommendedActions
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::BCMRecommendedActions::EndpointProvider',
17
+ rbs_type: 'untyped',
18
+ docstring: <<~DOCS) do |_cfg|
19
+ The endpoint provider used to resolve endpoints. Any object that responds to
20
+ `#resolve_endpoint(parameters)` where `parameters` is a Struct similar to
21
+ `Aws::BCMRecommendedActions::EndpointParameters`.
22
+ DOCS
23
+ Aws::BCMRecommendedActions::EndpointProvider.new
24
+ end
25
+
26
+ # @api private
27
+ class Handler < Seahorse::Client::Handler
28
+ def call(context)
29
+ unless context[:discovered_endpoint]
30
+ params = Aws::BCMRecommendedActions::Endpoints.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
+
36
+ context[:endpoint_params] = params
37
+ context[:endpoint_properties] = endpoint.properties
38
+ end
39
+
40
+ context[:auth_scheme] =
41
+ Aws::Endpoints.resolve_auth_scheme(context, endpoint)
42
+
43
+ with_metrics(context) { @handler.call(context) }
44
+ end
45
+
46
+ private
47
+
48
+ def with_metrics(context, &block)
49
+ metrics = []
50
+ metrics << 'ENDPOINT_OVERRIDE' unless context.config.regional_endpoint
51
+ if context[:auth_scheme] && context[:auth_scheme]['name'] == 'sigv4a'
52
+ metrics << 'SIGV4A_SIGNING'
53
+ end
54
+ if context.config.credentials&.credentials&.account_id
55
+ metrics << 'RESOLVED_ACCOUNT_ID'
56
+ end
57
+ Aws::Plugins::UserAgent.metric(*metrics, &block)
58
+ end
59
+
60
+ def apply_endpoint_headers(context, headers)
61
+ headers.each do |key, values|
62
+ value = values
63
+ .compact
64
+ .map { |s| Seahorse::Util.escape_header_list_string(s.to_s) }
65
+ .join(',')
66
+
67
+ context.http_request.headers[key] = value
68
+ end
69
+ end
70
+ end
71
+
72
+ def add_handlers(handlers, _config)
73
+ handlers.add(Handler, step: :build, priority: 75)
74
+ end
75
+ end
76
+ end
77
+ 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::BCMRecommendedActions
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