aws-sdk-core 3.211.0 → 3.225.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.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +161 -0
  3. data/VERSION +1 -1
  4. data/lib/aws-defaults/default_configuration.rb +1 -2
  5. data/lib/aws-sdk-core/arn.rb +1 -3
  6. data/lib/aws-sdk-core/assume_role_credentials.rb +1 -0
  7. data/lib/aws-sdk-core/assume_role_web_identity_credentials.rb +1 -0
  8. data/lib/aws-sdk-core/cbor/decoder.rb +0 -2
  9. data/lib/aws-sdk-core/cbor/encoder.rb +2 -2
  10. data/lib/aws-sdk-core/client_stubs.rb +22 -48
  11. data/lib/aws-sdk-core/credential_provider.rb +4 -0
  12. data/lib/aws-sdk-core/credential_provider_chain.rb +27 -7
  13. data/lib/aws-sdk-core/credentials.rb +6 -0
  14. data/lib/aws-sdk-core/ecs_credentials.rb +1 -0
  15. data/lib/aws-sdk-core/errors.rb +2 -2
  16. data/lib/aws-sdk-core/instance_profile_credentials.rb +1 -0
  17. data/lib/aws-sdk-core/log/param_formatter.rb +7 -3
  18. data/lib/aws-sdk-core/plugins/checksum_algorithm.rb +332 -170
  19. data/lib/aws-sdk-core/plugins/client_metrics_plugin.rb +0 -1
  20. data/lib/aws-sdk-core/plugins/endpoint_pattern.rb +40 -32
  21. data/lib/aws-sdk-core/plugins/http_checksum.rb +2 -8
  22. data/lib/aws-sdk-core/plugins/sign.rb +16 -2
  23. data/lib/aws-sdk-core/plugins/stub_responses.rb +24 -8
  24. data/lib/aws-sdk-core/plugins/user_agent.rb +32 -2
  25. data/lib/aws-sdk-core/process_credentials.rb +1 -1
  26. data/lib/aws-sdk-core/rest/request/headers.rb +1 -1
  27. data/lib/aws-sdk-core/shared_config.rb +74 -21
  28. data/lib/aws-sdk-core/shared_credentials.rb +1 -0
  29. data/lib/aws-sdk-core/sso_credentials.rb +2 -0
  30. data/lib/aws-sdk-sso/client.rb +53 -31
  31. data/lib/aws-sdk-sso/endpoint_provider.rb +14 -18
  32. data/lib/aws-sdk-sso.rb +1 -1
  33. data/lib/aws-sdk-ssooidc/client.rb +90 -51
  34. data/lib/aws-sdk-ssooidc/client_api.rb +6 -0
  35. data/lib/aws-sdk-ssooidc/endpoint_provider.rb +14 -18
  36. data/lib/aws-sdk-ssooidc/types.rb +48 -16
  37. data/lib/aws-sdk-ssooidc.rb +1 -1
  38. data/lib/aws-sdk-sts/client.rb +261 -83
  39. data/lib/aws-sdk-sts/client_api.rb +31 -8
  40. data/lib/aws-sdk-sts/endpoint_provider.rb +50 -55
  41. data/lib/aws-sdk-sts/errors.rb +16 -0
  42. data/lib/aws-sdk-sts/types.rb +170 -28
  43. data/lib/aws-sdk-sts.rb +1 -1
  44. data/lib/seahorse/client/async_base.rb +4 -5
  45. data/lib/seahorse/client/base.rb +0 -14
  46. data/lib/seahorse/client/h2/connection.rb +18 -28
  47. data/lib/seahorse/client/http/response.rb +1 -1
  48. data/lib/seahorse/client/net_http/connection_pool.rb +2 -0
  49. data/lib/seahorse/client/networking_error.rb +1 -1
  50. data/lib/seahorse/client/plugins/h2.rb +4 -4
  51. data/lib/seahorse/client/response.rb +2 -0
  52. data/sig/aws-sdk-core/async_client_stubs.rbs +21 -0
  53. data/sig/seahorse/client/async_base.rbs +18 -0
  54. metadata +40 -14
@@ -26,10 +26,21 @@ module Aws::STS
26
26
  # that use the temporary security credentials will expose the role
27
27
  # session name to the external account in their CloudTrail logs.
28
28
  #
29
+ # For security purposes, administrators can view this field in
30
+ # [CloudTrail logs][1] to help identify who performed an action in
31
+ # Amazon Web Services. Your administrator might require that you
32
+ # specify your user name as the session name when you assume the role.
33
+ # For more information, see [ `sts:RoleSessionName` ][2].
34
+ #
29
35
  # The regex used to validate this parameter is a string of characters
30
36
  # consisting of upper- and lower-case alphanumeric characters with no
31
37
  # spaces. You can also include underscores or any of the following
32
38
  # characters: =,.@-
39
+ #
40
+ #
41
+ #
42
+ # [1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html#cloudtrail-integration_signin-tempcreds
43
+ # [2]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_iam-condition-keys.html#ck_rolesessionname
33
44
  # @return [String]
34
45
  #
35
46
  # @!attribute [rw] policy_arns
@@ -101,6 +112,9 @@ module Aws::STS
101
112
  #
102
113
  # </note>
103
114
  #
115
+ # For more information about role session permissions, see [Session
116
+ # policies][1].
117
+ #
104
118
  #
105
119
  #
106
120
  # [1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session
@@ -125,8 +139,7 @@ module Aws::STS
125
139
  # However, if you assume a role using role chaining and provide a
126
140
  # `DurationSeconds` parameter value greater than one hour, the
127
141
  # operation fails. To learn how to view the maximum value for your
128
- # role, see [View the Maximum Session Duration Setting for a Role][1]
129
- # in the *IAM User Guide*.
142
+ # role, see [Update the maximum session duration for a role][1].
130
143
  #
131
144
  # By default, the value is set to `3600` seconds.
132
145
  #
@@ -142,7 +155,7 @@ module Aws::STS
142
155
  #
143
156
  #
144
157
  #
145
- # [1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session
158
+ # [1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_update-role-settings.html#id_roles_update-session-duration
146
159
  # [2]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html
147
160
  # @return [Integer]
148
161
  #
@@ -199,9 +212,8 @@ module Aws::STS
199
212
  # passes to subsequent sessions in a role chain. For more information,
200
213
  # see [Chaining Roles with Session Tags][1] in the *IAM User Guide*.
201
214
  #
202
- # This parameter is optional. When you set session tags as transitive,
203
- # the session policy and session tags packed binary limit is not
204
- # affected.
215
+ # This parameter is optional. The transitive status of a session tag
216
+ # does not impact its packed binary size.
205
217
  #
206
218
  # If you choose not to specify a transitive tag key, then no tags are
207
219
  # passed from this session to any subsequent sessions.
@@ -263,28 +275,31 @@ module Aws::STS
263
275
  #
264
276
  # @!attribute [rw] source_identity
265
277
  # The source identity specified by the principal that is calling the
266
- # `AssumeRole` operation.
278
+ # `AssumeRole` operation. The source identity value persists across
279
+ # [chained role][1] sessions.
267
280
  #
268
281
  # You can require users to specify a source identity when they assume
269
- # a role. You do this by using the `sts:SourceIdentity` condition key
270
- # in a role trust policy. You can use source identity information in
271
- # CloudTrail logs to determine who took actions with a role. You can
272
- # use the `aws:SourceIdentity` condition key to further control access
273
- # to Amazon Web Services resources based on the value of source
274
- # identity. For more information about using source identity, see
275
- # [Monitor and control actions taken with assumed roles][1] in the
276
- # *IAM User Guide*.
282
+ # a role. You do this by using the [ `sts:SourceIdentity` ][2]
283
+ # condition key in a role trust policy. You can use source identity
284
+ # information in CloudTrail logs to determine who took actions with a
285
+ # role. You can use the `aws:SourceIdentity` condition key to further
286
+ # control access to Amazon Web Services resources based on the value
287
+ # of source identity. For more information about using source
288
+ # identity, see [Monitor and control actions taken with assumed
289
+ # roles][3] in the *IAM User Guide*.
277
290
  #
278
291
  # The regex used to validate this parameter is a string of characters
279
292
  # consisting of upper- and lower-case alphanumeric characters with no
280
293
  # spaces. You can also include underscores or any of the following
281
- # characters: =,.@-. You cannot use a value that begins with the text
294
+ # characters: +=,.@-. You cannot use a value that begins with the text
282
295
  # `aws:`. This prefix is reserved for Amazon Web Services internal
283
296
  # use.
284
297
  #
285
298
  #
286
299
  #
287
- # [1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html
300
+ # [1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html#iam-term-role-chaining
301
+ # [2]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-sourceidentity
302
+ # [3]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html
288
303
  # @return [String]
289
304
  #
290
305
  # @!attribute [rw] provided_contexts
@@ -297,7 +312,7 @@ module Aws::STS
297
312
  # context provider from which the trusted context assertion was
298
313
  # generated.
299
314
  #
300
- # `[\{"ProviderArn":"arn:aws:iam::aws:contextProvider/IdentityCenter","ContextAssertion":"trusted-context-assertion"\}]`
315
+ # `[{"ProviderArn":"arn:aws:iam::aws:contextProvider/IdentityCenter","ContextAssertion":"trusted-context-assertion"}]`
301
316
  # @return [Array<Types::ProvidedContext>]
302
317
  #
303
318
  # @see http://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleRequest AWS API Documentation
@@ -465,6 +480,9 @@ module Aws::STS
465
480
  # include the tab (\\u0009), linefeed (\\u000A), and carriage return
466
481
  # (\\u000D) characters.
467
482
  #
483
+ # For more information about role session permissions, see [Session
484
+ # policies][1].
485
+ #
468
486
  # <note markdown="1"> An Amazon Web Services conversion compresses the passed inline
469
487
  # session policy, managed policy ARNs, and session tags into a packed
470
488
  # binary format that has a separate limit. Your request can fail for
@@ -600,6 +618,8 @@ module Aws::STS
600
618
  #
601
619
  # @!attribute [rw] source_identity
602
620
  # The value in the `SourceIdentity` attribute in the SAML assertion.
621
+ # The source identity value persists across [chained role][1]
622
+ # sessions.
603
623
  #
604
624
  # You can require users to set a source identity value when they
605
625
  # assume a role. You do this by using the `sts:SourceIdentity`
@@ -607,12 +627,12 @@ module Aws::STS
607
627
  # taken with the role are associated with that user. After the source
608
628
  # identity is set, the value cannot be changed. It is present in the
609
629
  # request for all actions that are taken by the role and persists
610
- # across [chained role][1] sessions. You can configure your SAML
630
+ # across [chained role][2] sessions. You can configure your SAML
611
631
  # identity provider to use an attribute associated with your users,
612
632
  # like user name or email, as the source identity when calling
613
633
  # `AssumeRoleWithSAML`. You do this by adding an attribute to the SAML
614
634
  # assertion. For more information about using source identity, see
615
- # [Monitor and control actions taken with assumed roles][2] in the
635
+ # [Monitor and control actions taken with assumed roles][3] in the
616
636
  # *IAM User Guide*.
617
637
  #
618
638
  # The regex used to validate this parameter is a string of characters
@@ -622,8 +642,9 @@ module Aws::STS
622
642
  #
623
643
  #
624
644
  #
625
- # [1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts#iam-term-role-chaining
626
- # [2]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html
645
+ # [1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html#iam-term-role-chaining
646
+ # [2]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html#id_roles_terms-and-concepts
647
+ # [3]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html
627
648
  # @return [String]
628
649
  #
629
650
  # @see http://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithSAMLResponse AWS API Documentation
@@ -645,6 +666,24 @@ module Aws::STS
645
666
  # @!attribute [rw] role_arn
646
667
  # The Amazon Resource Name (ARN) of the role that the caller is
647
668
  # assuming.
669
+ #
670
+ # <note markdown="1"> Additional considerations apply to Amazon Cognito identity pools
671
+ # that assume [cross-account IAM roles][1]. The trust policies of
672
+ # these roles must accept the `cognito-identity.amazonaws.com` service
673
+ # principal and must contain the `cognito-identity.amazonaws.com:aud`
674
+ # condition key to restrict role assumption to users from your
675
+ # intended identity pools. A policy that trusts Amazon Cognito
676
+ # identity pools without this condition creates a risk that a user
677
+ # from an unintended identity pool can assume the role. For more
678
+ # information, see [ Trust policies for IAM roles in Basic (Classic)
679
+ # authentication ][2] in the *Amazon Cognito Developer Guide*.
680
+ #
681
+ # </note>
682
+ #
683
+ #
684
+ #
685
+ # [1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies-cross-account-resource-access.html
686
+ # [2]: https://docs.aws.amazon.com/cognito/latest/developerguide/iam-roles.html#trust-policies
648
687
  # @return [String]
649
688
  #
650
689
  # @!attribute [rw] role_session_name
@@ -655,10 +694,21 @@ module Aws::STS
655
694
  # session name is included as part of the ARN and assumed role ID in
656
695
  # the `AssumedRoleUser` response element.
657
696
  #
697
+ # For security purposes, administrators can view this field in
698
+ # [CloudTrail logs][1] to help identify who performed an action in
699
+ # Amazon Web Services. Your administrator might require that you
700
+ # specify your user name as the session name when you assume the role.
701
+ # For more information, see [ `sts:RoleSessionName` ][2].
702
+ #
658
703
  # The regex used to validate this parameter is a string of characters
659
704
  # consisting of upper- and lower-case alphanumeric characters with no
660
705
  # spaces. You can also include underscores or any of the following
661
706
  # characters: =,.@-
707
+ #
708
+ #
709
+ #
710
+ # [1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html#cloudtrail-integration_signin-tempcreds
711
+ # [2]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_iam-condition-keys.html#ck_rolesessionname
662
712
  # @return [String]
663
713
  #
664
714
  # @!attribute [rw] web_identity_token
@@ -666,8 +716,10 @@ module Aws::STS
666
716
  # provided by the identity provider. Your application must get this
667
717
  # token by authenticating the user who is using your application with
668
718
  # a web identity provider before the application makes an
669
- # `AssumeRoleWithWebIdentity` call. Only tokens with RSA algorithms
670
- # (RS256) are supported.
719
+ # `AssumeRoleWithWebIdentity` call. Timestamps in the token must be
720
+ # formatted as either an integer or a long integer. Tokens must be
721
+ # signed using either RSA keys (RS256, RS384, or RS512) or ECDSA keys
722
+ # (ES256, ES384, or ES512).
671
723
  # @return [String]
672
724
  #
673
725
  # @!attribute [rw] provider_id
@@ -741,6 +793,9 @@ module Aws::STS
741
793
  # include the tab (\\u0009), linefeed (\\u000A), and carriage return
742
794
  # (\\u000D) characters.
743
795
  #
796
+ # For more information about role session permissions, see [Session
797
+ # policies][1].
798
+ #
744
799
  # <note markdown="1"> An Amazon Web Services conversion compresses the passed inline
745
800
  # session policy, managed policy ARNs, and session tags into a packed
746
801
  # binary format that has a separate limit. Your request can fail for
@@ -881,7 +936,7 @@ module Aws::STS
881
936
  #
882
937
  #
883
938
  #
884
- # [1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts#iam-term-role-chaining
939
+ # [1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html#id_roles_terms-and-concepts
885
940
  # [2]: https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-tokens-with-identity-providers.html
886
941
  # [3]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html
887
942
  # @return [String]
@@ -900,6 +955,92 @@ module Aws::STS
900
955
  include Aws::Structure
901
956
  end
902
957
 
958
+ # @!attribute [rw] target_principal
959
+ # The member account principal ARN or account ID.
960
+ # @return [String]
961
+ #
962
+ # @!attribute [rw] task_policy_arn
963
+ # The identity based policy that scopes the session to the privileged
964
+ # tasks that can be performed. You can use one of following Amazon Web
965
+ # Services managed policies to scope root session actions.
966
+ #
967
+ # * [IAMAuditRootUserCredentials][1]
968
+ #
969
+ # * [IAMCreateRootUserPassword][2]
970
+ #
971
+ # * [IAMDeleteRootUserCredentials][3]
972
+ #
973
+ # * [S3UnlockBucketPolicy][4]
974
+ #
975
+ # * [SQSUnlockQueuePolicy][5]
976
+ #
977
+ #
978
+ #
979
+ # [1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMAuditRootUserCredentials
980
+ # [2]: https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMCreateRootUserPassword
981
+ # [3]: https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMDeleteRootUserCredentials
982
+ # [4]: https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-S3UnlockBucketPolicy
983
+ # [5]: https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-SQSUnlockQueuePolicy
984
+ # @return [Types::PolicyDescriptorType]
985
+ #
986
+ # @!attribute [rw] duration_seconds
987
+ # The duration, in seconds, of the privileged session. The value can
988
+ # range from 0 seconds up to the maximum session duration of 900
989
+ # seconds (15 minutes). If you specify a value higher than this
990
+ # setting, the operation fails.
991
+ #
992
+ # By default, the value is set to `900` seconds.
993
+ # @return [Integer]
994
+ #
995
+ # @see http://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRootRequest AWS API Documentation
996
+ #
997
+ class AssumeRootRequest < Struct.new(
998
+ :target_principal,
999
+ :task_policy_arn,
1000
+ :duration_seconds)
1001
+ SENSITIVE = []
1002
+ include Aws::Structure
1003
+ end
1004
+
1005
+ # @!attribute [rw] credentials
1006
+ # The temporary security credentials, which include an access key ID,
1007
+ # a secret access key, and a security token.
1008
+ #
1009
+ # <note markdown="1"> The size of the security token that STS API operations return is not
1010
+ # fixed. We strongly recommend that you make no assumptions about the
1011
+ # maximum size.
1012
+ #
1013
+ # </note>
1014
+ # @return [Types::Credentials]
1015
+ #
1016
+ # @!attribute [rw] source_identity
1017
+ # The source identity specified by the principal that is calling the
1018
+ # `AssumeRoot` operation.
1019
+ #
1020
+ # You can use the `aws:SourceIdentity` condition key to control access
1021
+ # based on the value of source identity. For more information about
1022
+ # using source identity, see [Monitor and control actions taken with
1023
+ # assumed roles][1] in the *IAM User Guide*.
1024
+ #
1025
+ # The regex used to validate this parameter is a string of characters
1026
+ # consisting of upper- and lower-case alphanumeric characters with no
1027
+ # spaces. You can also include underscores or any of the following
1028
+ # characters: =,.@-
1029
+ #
1030
+ #
1031
+ #
1032
+ # [1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html
1033
+ # @return [String]
1034
+ #
1035
+ # @see http://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRootResponse AWS API Documentation
1036
+ #
1037
+ class AssumeRootResponse < Struct.new(
1038
+ :credentials,
1039
+ :source_identity)
1040
+ SENSITIVE = []
1041
+ include Aws::Structure
1042
+ end
1043
+
903
1044
  # The identifiers for the temporary security credentials that the
904
1045
  # operation returns.
905
1046
  #
@@ -1419,7 +1560,8 @@ module Aws::STS
1419
1560
 
1420
1561
  # The error returned if the message passed to
1421
1562
  # `DecodeAuthorizationMessage` was invalid. This can happen if the token
1422
- # contains invalid characters, such as linebreaks.
1563
+ # contains invalid characters, such as line breaks, or if the message
1564
+ # has expired.
1423
1565
  #
1424
1566
  # @!attribute [rw] message
1425
1567
  # @return [String]
@@ -1539,8 +1681,8 @@ module Aws::STS
1539
1681
  # STS is not activated in the requested region for the account that is
1540
1682
  # being asked to generate credentials. The account administrator must
1541
1683
  # use the IAM console to activate STS in that region. For more
1542
- # information, see [Activating and Deactivating Amazon Web Services STS
1543
- # in an Amazon Web Services Region][1] in the *IAM User Guide*.
1684
+ # information, see [Activating and Deactivating STS in an Amazon Web
1685
+ # Services Region][1] in the *IAM User Guide*.
1544
1686
  #
1545
1687
  #
1546
1688
  #
data/lib/aws-sdk-sts.rb CHANGED
@@ -56,7 +56,7 @@ module Aws::STS
56
56
  autoload :EndpointProvider, 'aws-sdk-sts/endpoint_provider'
57
57
  autoload :Endpoints, 'aws-sdk-sts/endpoints'
58
58
 
59
- GEM_VERSION = '3.211.0'
59
+ GEM_VERSION = '3.225.0'
60
60
 
61
61
  end
62
62
 
@@ -3,7 +3,6 @@
3
3
  module Seahorse
4
4
  module Client
5
5
  class AsyncBase < Seahorse::Client::Base
6
-
7
6
  # default H2 plugins
8
7
  # @api private
9
8
  @plugins = PluginList.new([
@@ -11,10 +10,10 @@ module Seahorse
11
10
  Plugins::H2,
12
11
  Plugins::ResponseTarget
13
12
  ])
13
+
14
14
  def initialize(plugins, options)
15
- super
16
- @connection = H2::Connection.new(options)
17
- @options = options
15
+ super(plugins, options)
16
+ @connection = H2::Connection.new(@config)
18
17
  end
19
18
 
20
19
  # @return [H2::Connection]
@@ -36,7 +35,7 @@ module Seahorse
36
35
  # @return [Seahorse::Client::H2::Connection]
37
36
  def new_connection
38
37
  if @connection.closed?
39
- @connection = H2::Connection.new(@options)
38
+ @connection = H2::Connection.new(@config)
40
39
  else
41
40
  @connection
42
41
  end
@@ -176,8 +176,6 @@ module Seahorse
176
176
  # @return [Model::Api]
177
177
  def set_api(api)
178
178
  @api = api
179
- define_operation_methods
180
- @api
181
179
  end
182
180
 
183
181
  # @option options [Model::Api, Hash] :api ({})
@@ -196,18 +194,6 @@ module Seahorse
196
194
 
197
195
  private
198
196
 
199
- def define_operation_methods
200
- operations_module = Module.new
201
- @api.operation_names.each do |method_name|
202
- operations_module.send(:define_method, method_name) do |*args, &block|
203
- params = args[0] || {}
204
- options = args[1] || {}
205
- build_request(method_name, params).send_request(options, &block)
206
- end
207
- end
208
- include(operations_module)
209
- end
210
-
211
197
  def build_plugins(plugins)
212
198
  plugins.map { |plugin| plugin.is_a?(Class) ? plugin.new : plugin }
213
199
  end
@@ -10,13 +10,8 @@ module Seahorse
10
10
  module Client
11
11
  # @api private
12
12
  module H2
13
-
14
13
  # H2 Connection build on top of `http/2` gem
15
- # (requires Ruby >= 2.1)
16
- # with TLS layer plus ALPN, requires:
17
- # Ruby >= 2.3 and OpenSSL >= 1.0.2
18
14
  class Connection
19
-
20
15
  OPTIONS = {
21
16
  max_concurrent_streams: 100,
22
17
  connection_timeout: 60,
@@ -27,7 +22,7 @@ module Seahorse
27
22
  ssl_ca_bundle: nil,
28
23
  ssl_ca_directory: nil,
29
24
  ssl_ca_store: nil,
30
- enable_alpn: false
25
+ enable_alpn: true
31
26
  }
32
27
 
33
28
  # chunk read size at socket
@@ -41,25 +36,23 @@ module Seahorse
41
36
  instance_variable_set("@#{opt_name}", value)
42
37
  end
43
38
  @h2_client = HTTP2::Client.new(
44
- settings_max_concurrent_streams: max_concurrent_streams
39
+ settings_max_concurrent_streams: @max_concurrent_streams
45
40
  )
46
- @logger = if @http_wire_trace
47
- options[:logger] || Logger.new($stdout)
48
- end
41
+ @logger ||= Logger.new($stdout) if @http_wire_trace
49
42
  @chunk_size = options[:read_chunk_size] || CHUNKSIZE
43
+
50
44
  @errors = []
51
45
  @status = :ready
46
+
52
47
  @mutex = Mutex.new # connection can be shared across requests
53
48
  @socket = nil
54
49
  @socket_thread = nil
55
50
  end
56
51
 
57
52
  OPTIONS.keys.each do |attr_name|
58
- attr_reader(attr_name)
53
+ attr_reader attr_name
59
54
  end
60
55
 
61
- alias ssl_verify_peer? ssl_verify_peer
62
-
63
56
  attr_reader :errors
64
57
 
65
58
  attr_accessor :input_signal_thread
@@ -112,7 +105,7 @@ module Seahorse
112
105
  @h2_client << data
113
106
  rescue IO::WaitReadable
114
107
  begin
115
- unless IO.select([@socket], nil, nil, connection_read_timeout)
108
+ unless IO.select([@socket], nil, nil, @connection_read_timeout)
116
109
  self.debug_output('socket connection read time out')
117
110
  self.close!
118
111
  else
@@ -154,11 +147,11 @@ module Seahorse
154
147
  end
155
148
 
156
149
  def debug_output(msg, type = nil)
157
- prefix = case type
150
+ prefix =
151
+ case type
158
152
  when :send then '-> '
159
153
  when :receive then '<- '
160
- else
161
- ''
154
+ else ''
162
155
  end
163
156
  return unless @logger
164
157
  _debug_entry(prefix + msg)
@@ -206,7 +199,7 @@ module Seahorse
206
199
  begin
207
200
  tcp.connect_nonblock(addr)
208
201
  rescue IO::WaitWritable
209
- unless IO.select(nil, [tcp], nil, connection_timeout)
202
+ unless IO.select(nil, [tcp], nil, @connection_timeout)
210
203
  tcp.close
211
204
  raise
212
205
  end
@@ -220,15 +213,15 @@ module Seahorse
220
213
 
221
214
  def _tls_context
222
215
  ssl_ctx = OpenSSL::SSL::SSLContext.new(:TLSv1_2)
223
- if ssl_verify_peer?
216
+ if @ssl_verify_peer
224
217
  ssl_ctx.verify_mode = OpenSSL::SSL::VERIFY_PEER
225
- ssl_ctx.ca_file = ssl_ca_bundle ? ssl_ca_bundle : _default_ca_bundle
226
- ssl_ctx.ca_path = ssl_ca_directory ? ssl_ca_directory : _default_ca_directory
227
- ssl_ctx.cert_store = ssl_ca_store if ssl_ca_store
218
+ ssl_ctx.ca_file = @ssl_ca_bundle || _default_ca_bundle
219
+ ssl_ctx.ca_path = @ssl_ca_directory || _default_ca_directory
220
+ ssl_ctx.cert_store = @ssl_ca_store if @ssl_ca_store
228
221
  else
229
222
  ssl_ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE
230
223
  end
231
- if enable_alpn
224
+ if @enable_alpn
232
225
  debug_output('enabling ALPN for TLS ...')
233
226
  ssl_ctx.alpn_protocols = ['h2']
234
227
  end
@@ -236,15 +229,12 @@ module Seahorse
236
229
  end
237
230
 
238
231
  def _default_ca_bundle
239
- File.exist?(OpenSSL::X509::DEFAULT_CERT_FILE) ?
240
- OpenSSL::X509::DEFAULT_CERT_FILE : nil
232
+ OpenSSL::X509::DEFAULT_CERT_FILE if File.exist?(OpenSSL::X509::DEFAULT_CERT_FILE)
241
233
  end
242
234
 
243
235
  def _default_ca_directory
244
- Dir.exist?(OpenSSL::X509::DEFAULT_CERT_DIR) ?
245
- OpenSSL::X509::DEFAULT_CERT_DIR : nil
236
+ OpenSSL::X509::DEFAULT_CERT_DIR if Dir.exist?(OpenSSL::X509::DEFAULT_CERT_DIR)
246
237
  end
247
-
248
238
  end
249
239
  end
250
240
  end
@@ -66,8 +66,8 @@ module Seahorse
66
66
  # @param [string] chunk
67
67
  def signal_data(chunk)
68
68
  unless chunk == ''
69
- @body.write(chunk)
70
69
  emit(:data, chunk)
70
+ @body.write(chunk)
71
71
  end
72
72
  end
73
73
 
@@ -336,6 +336,8 @@ module Seahorse
336
336
  attr_reader :last_used
337
337
 
338
338
  def __getobj__
339
+ return yield if block_given? && !defined?(@http)
340
+
339
341
  @http
340
342
  end
341
343
 
@@ -39,7 +39,7 @@ module Seahorse
39
39
 
40
40
  end
41
41
 
42
- # Rasied when trying to use an closed connection
42
+ # Raised when trying to use an closed connection
43
43
  class Http2ConnectionClosedError < StandardError; end
44
44
  end
45
45
  end
@@ -53,10 +53,10 @@ When `true`, SSL peer certificates are verified when establishing a connection.
53
53
  When `true`, HTTP2 debug output will be sent to the `:logger`.
54
54
  DOCS
55
55
 
56
- option(:enable_alpn, default: false, doc_type: 'Boolean', docstring: <<-DOCS)
57
- Set to `true` to enable ALPN in HTTP2 over TLS. Requires Openssl version >= 1.0.2.
58
- Defaults to false. Note: not all service HTTP2 operations supports ALPN on server
59
- side, please refer to service documentation.
56
+ option(:enable_alpn, default: true, doc_type: 'Boolean', docstring: <<-DOCS)
57
+ Set to `false` to disable ALPN in HTTP2 over TLS. ALPN requires Openssl version >= 1.0.2.
58
+ Note: RFC7540 requires HTTP2 to use ALPN over TLS but some
59
+ services may not fully support ALPN and require setting this to `false`.
60
60
  DOCS
61
61
 
62
62
  option(:logger)
@@ -75,6 +75,8 @@ module Seahorse
75
75
  # Necessary to define as a subclass of Delegator
76
76
  # @api private
77
77
  def __getobj__
78
+ return yield if block_given? && !defined?(@data)
79
+
78
80
  @data
79
81
  end
80
82
 
@@ -0,0 +1,21 @@
1
+ module Aws
2
+ module AsyncClientStubs
3
+ include ClientStubs
4
+
5
+ def send_events: () -> untyped
6
+
7
+ class StubsStream
8
+ def initialize: () -> void
9
+
10
+ attr_accessor send_events: untyped
11
+
12
+ attr_reader state: Symbol
13
+
14
+ def data: (untyped bytes, ?::Hash[untyped, untyped] options) -> untyped
15
+
16
+ def closed?: () -> bool
17
+
18
+ def close: () -> void
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,18 @@
1
+ module Seahorse
2
+ module Client
3
+ class AsyncBase < Base
4
+
5
+ def self.new: (?untyped options) -> instance
6
+
7
+ attr_reader connection: untyped
8
+
9
+ def operation_names: () -> Array[Symbol]
10
+
11
+ def close_connection: () -> Symbol
12
+
13
+ def new_connection: () -> untyped
14
+
15
+ def connection_errors: () -> Array[untyped]
16
+ end
17
+ end
18
+ end