aws-sdk-prometheusservice 1.7.0 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e47eca1fe90ed00f254f6cafbd2c08108c57bc81c3712671b3a299169f12f229
4
- data.tar.gz: 5c72ca098375811d5b5a96904707de39e1c7df1b7e09544b4a5ff5262ff422a3
3
+ metadata.gz: 47f8777608ce12a490689bc5304d654f08ea3f045194a5e99879979397bbc152
4
+ data.tar.gz: b1733d8664b41bc94834cd211aed4ee63cf0eaa8f137461c9af2220d9c73f702
5
5
  SHA512:
6
- metadata.gz: 365b1348bfd864cb259e6db989ebdb770ce0a98c2fc94b675ed4cd5d38d57bacca768f865ebccae25ba2988b7accaa0c48039b8e9084235efa02ea7c27b03a50
7
- data.tar.gz: 95a08bc05f9de681076c56cf3bfe4c7ee2c231c98232c00ae080644518e4f4a92e8ea72be2b8ba4af4658e2e3b0c580647ee5e9a176363518b60182e41b7f24d
6
+ metadata.gz: ae7a376069ebcab8ea99a1e50d135e2ddeac4e3945ce2ea129bff7fe5564505259dbc0cca6b562fbfc1df3979747277c407a5f238e5360fc9af1b3f16a696c8a
7
+ data.tar.gz: 884c99d3f4734ade834a15685bce6e0b0379e4f0f3826535721e1bbef79934ad23d033aa42fbd1a39898335ff06fffe825e087e9760a28935ce3118576b02986
data/CHANGELOG.md CHANGED
@@ -1,6 +1,26 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 1.11.0 (2021-11-30)
5
+ ------------------
6
+
7
+ * Feature - Code Generated Changes, see `./build_tools` or `aws-sdk-core`'s CHANGELOG.md for details.
8
+
9
+ 1.10.0 (2021-11-04)
10
+ ------------------
11
+
12
+ * Feature - Code Generated Changes, see `./build_tools` or `aws-sdk-core`'s CHANGELOG.md for details.
13
+
14
+ 1.9.0 (2021-10-18)
15
+ ------------------
16
+
17
+ * Feature - Code Generated Changes, see `./build_tools` or `aws-sdk-core`'s CHANGELOG.md for details.
18
+
19
+ 1.8.0 (2021-09-29)
20
+ ------------------
21
+
22
+ * Feature - This release adds alert manager and rule group namespace APIs
23
+
4
24
  1.7.0 (2021-09-07)
5
25
  ------------------
6
26
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.7.0
1
+ 1.11.0
@@ -119,7 +119,9 @@ module Aws::PrometheusService
119
119
  # * EC2/ECS IMDS instance profile - When used by default, the timeouts
120
120
  # are very aggressive. Construct and pass an instance of
121
121
  # `Aws::InstanceProfileCredentails` or `Aws::ECSCredentials` to
122
- # enable retries and extended timeouts.
122
+ # enable retries and extended timeouts. Instance profile credential
123
+ # fetching can be disabled by setting ENV['AWS_EC2_METADATA_DISABLED']
124
+ # to true.
123
125
  #
124
126
  # @option options [required, String] :region
125
127
  # The AWS region to connect to. The configured `:region` is
@@ -275,6 +277,15 @@ module Aws::PrometheusService
275
277
  # ** Please note ** When response stubbing is enabled, no HTTP
276
278
  # requests are made, and retries are disabled.
277
279
  #
280
+ # @option options [Boolean] :use_dualstack_endpoint
281
+ # When set to `true`, dualstack enabled endpoints (with `.aws` TLD)
282
+ # will be used if available.
283
+ #
284
+ # @option options [Boolean] :use_fips_endpoint
285
+ # When set to `true`, fips compatible endpoints will be used if available.
286
+ # When a `fips` region is used, the region is normalized and this config
287
+ # is set to `true`.
288
+ #
278
289
  # @option options [Boolean] :validate_params (true)
279
290
  # When `true`, request parameters are validated before
280
291
  # sending the request.
@@ -327,6 +338,106 @@ module Aws::PrometheusService
327
338
 
328
339
  # @!group API Operations
329
340
 
341
+ # Create an alert manager definition.
342
+ #
343
+ # @option params [String] :client_token
344
+ # Optional, unique, case-sensitive, user-provided identifier to ensure
345
+ # the idempotency of the request.
346
+ #
347
+ # **A suitable default value is auto-generated.** You should normally
348
+ # not need to pass this option.**
349
+ #
350
+ # @option params [required, String, StringIO, File] :data
351
+ # The alert manager definition data.
352
+ #
353
+ # @option params [required, String] :workspace_id
354
+ # The ID of the workspace in which to create the alert manager
355
+ # definition.
356
+ #
357
+ # @return [Types::CreateAlertManagerDefinitionResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
358
+ #
359
+ # * {Types::CreateAlertManagerDefinitionResponse#status #status} => Types::AlertManagerDefinitionStatus
360
+ #
361
+ # @example Request syntax with placeholder values
362
+ #
363
+ # resp = client.create_alert_manager_definition({
364
+ # client_token: "IdempotencyToken",
365
+ # data: "data", # required
366
+ # workspace_id: "WorkspaceId", # required
367
+ # })
368
+ #
369
+ # @example Response structure
370
+ #
371
+ # resp.status.status_code #=> String, one of "CREATING", "ACTIVE", "UPDATING", "DELETING", "CREATION_FAILED", "UPDATE_FAILED"
372
+ # resp.status.status_reason #=> String
373
+ #
374
+ # @see http://docs.aws.amazon.com/goto/WebAPI/amp-2020-08-01/CreateAlertManagerDefinition AWS API Documentation
375
+ #
376
+ # @overload create_alert_manager_definition(params = {})
377
+ # @param [Hash] params ({})
378
+ def create_alert_manager_definition(params = {}, options = {})
379
+ req = build_request(:create_alert_manager_definition, params)
380
+ req.send_request(options)
381
+ end
382
+
383
+ # Create a rule group namespace.
384
+ #
385
+ # @option params [String] :client_token
386
+ # Optional, unique, case-sensitive, user-provided identifier to ensure
387
+ # the idempotency of the request.
388
+ #
389
+ # **A suitable default value is auto-generated.** You should normally
390
+ # not need to pass this option.**
391
+ #
392
+ # @option params [required, String, StringIO, File] :data
393
+ # The namespace data that define the rule groups.
394
+ #
395
+ # @option params [required, String] :name
396
+ # The rule groups namespace name.
397
+ #
398
+ # @option params [Hash<String,String>] :tags
399
+ # Optional, user-provided tags for this rule groups namespace.
400
+ #
401
+ # @option params [required, String] :workspace_id
402
+ # The ID of the workspace in which to create the rule group namespace.
403
+ #
404
+ # @return [Types::CreateRuleGroupsNamespaceResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
405
+ #
406
+ # * {Types::CreateRuleGroupsNamespaceResponse#arn #arn} => String
407
+ # * {Types::CreateRuleGroupsNamespaceResponse#name #name} => String
408
+ # * {Types::CreateRuleGroupsNamespaceResponse#status #status} => Types::RuleGroupsNamespaceStatus
409
+ # * {Types::CreateRuleGroupsNamespaceResponse#tags #tags} => Hash&lt;String,String&gt;
410
+ #
411
+ # @example Request syntax with placeholder values
412
+ #
413
+ # resp = client.create_rule_groups_namespace({
414
+ # client_token: "IdempotencyToken",
415
+ # data: "data", # required
416
+ # name: "RuleGroupsNamespaceName", # required
417
+ # tags: {
418
+ # "TagKey" => "TagValue",
419
+ # },
420
+ # workspace_id: "WorkspaceId", # required
421
+ # })
422
+ #
423
+ # @example Response structure
424
+ #
425
+ # resp.arn #=> String
426
+ # resp.name #=> String
427
+ # resp.status.status_code #=> String, one of "CREATING", "ACTIVE", "UPDATING", "DELETING", "CREATION_FAILED", "UPDATE_FAILED"
428
+ # resp.status.status_reason #=> String
429
+ # resp.tags #=> Hash
430
+ # resp.tags["TagKey"] #=> String
431
+ #
432
+ # @see http://docs.aws.amazon.com/goto/WebAPI/amp-2020-08-01/CreateRuleGroupsNamespace AWS API Documentation
433
+ #
434
+ # @overload create_rule_groups_namespace(params = {})
435
+ # @param [Hash] params ({})
436
+ def create_rule_groups_namespace(params = {}, options = {})
437
+ req = build_request(:create_rule_groups_namespace, params)
438
+ req.send_request(options)
439
+ end
440
+
330
441
  # Creates a new AMP workspace.
331
442
  #
332
443
  # @option params [String] :alias
@@ -377,6 +488,71 @@ module Aws::PrometheusService
377
488
  req.send_request(options)
378
489
  end
379
490
 
491
+ # Deletes an alert manager definition.
492
+ #
493
+ # @option params [String] :client_token
494
+ # Optional, unique, case-sensitive, user-provided identifier to ensure
495
+ # the idempotency of the request.
496
+ #
497
+ # **A suitable default value is auto-generated.** You should normally
498
+ # not need to pass this option.**
499
+ #
500
+ # @option params [required, String] :workspace_id
501
+ # The ID of the workspace in which to delete the alert manager
502
+ # definition.
503
+ #
504
+ # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
505
+ #
506
+ # @example Request syntax with placeholder values
507
+ #
508
+ # resp = client.delete_alert_manager_definition({
509
+ # client_token: "IdempotencyToken",
510
+ # workspace_id: "WorkspaceId", # required
511
+ # })
512
+ #
513
+ # @see http://docs.aws.amazon.com/goto/WebAPI/amp-2020-08-01/DeleteAlertManagerDefinition AWS API Documentation
514
+ #
515
+ # @overload delete_alert_manager_definition(params = {})
516
+ # @param [Hash] params ({})
517
+ def delete_alert_manager_definition(params = {}, options = {})
518
+ req = build_request(:delete_alert_manager_definition, params)
519
+ req.send_request(options)
520
+ end
521
+
522
+ # Delete a rule groups namespace.
523
+ #
524
+ # @option params [String] :client_token
525
+ # Optional, unique, case-sensitive, user-provided identifier to ensure
526
+ # the idempotency of the request.
527
+ #
528
+ # **A suitable default value is auto-generated.** You should normally
529
+ # not need to pass this option.**
530
+ #
531
+ # @option params [required, String] :name
532
+ # The rule groups namespace name.
533
+ #
534
+ # @option params [required, String] :workspace_id
535
+ # The ID of the workspace to delete rule group definition.
536
+ #
537
+ # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
538
+ #
539
+ # @example Request syntax with placeholder values
540
+ #
541
+ # resp = client.delete_rule_groups_namespace({
542
+ # client_token: "IdempotencyToken",
543
+ # name: "RuleGroupsNamespaceName", # required
544
+ # workspace_id: "WorkspaceId", # required
545
+ # })
546
+ #
547
+ # @see http://docs.aws.amazon.com/goto/WebAPI/amp-2020-08-01/DeleteRuleGroupsNamespace AWS API Documentation
548
+ #
549
+ # @overload delete_rule_groups_namespace(params = {})
550
+ # @param [Hash] params ({})
551
+ def delete_rule_groups_namespace(params = {}, options = {})
552
+ req = build_request(:delete_rule_groups_namespace, params)
553
+ req.send_request(options)
554
+ end
555
+
380
556
  # Deletes an AMP workspace.
381
557
  #
382
558
  # @option params [String] :client_token
@@ -407,6 +583,78 @@ module Aws::PrometheusService
407
583
  req.send_request(options)
408
584
  end
409
585
 
586
+ # Describes an alert manager definition.
587
+ #
588
+ # @option params [required, String] :workspace_id
589
+ # The ID of the workspace to describe.
590
+ #
591
+ # @return [Types::DescribeAlertManagerDefinitionResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
592
+ #
593
+ # * {Types::DescribeAlertManagerDefinitionResponse#alert_manager_definition #alert_manager_definition} => Types::AlertManagerDefinitionDescription
594
+ #
595
+ # @example Request syntax with placeholder values
596
+ #
597
+ # resp = client.describe_alert_manager_definition({
598
+ # workspace_id: "WorkspaceId", # required
599
+ # })
600
+ #
601
+ # @example Response structure
602
+ #
603
+ # resp.alert_manager_definition.created_at #=> Time
604
+ # resp.alert_manager_definition.data #=> String
605
+ # resp.alert_manager_definition.modified_at #=> Time
606
+ # resp.alert_manager_definition.status.status_code #=> String, one of "CREATING", "ACTIVE", "UPDATING", "DELETING", "CREATION_FAILED", "UPDATE_FAILED"
607
+ # resp.alert_manager_definition.status.status_reason #=> String
608
+ #
609
+ # @see http://docs.aws.amazon.com/goto/WebAPI/amp-2020-08-01/DescribeAlertManagerDefinition AWS API Documentation
610
+ #
611
+ # @overload describe_alert_manager_definition(params = {})
612
+ # @param [Hash] params ({})
613
+ def describe_alert_manager_definition(params = {}, options = {})
614
+ req = build_request(:describe_alert_manager_definition, params)
615
+ req.send_request(options)
616
+ end
617
+
618
+ # Describe a rule groups namespace.
619
+ #
620
+ # @option params [required, String] :name
621
+ # The rule groups namespace.
622
+ #
623
+ # @option params [required, String] :workspace_id
624
+ # The ID of the workspace to describe.
625
+ #
626
+ # @return [Types::DescribeRuleGroupsNamespaceResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
627
+ #
628
+ # * {Types::DescribeRuleGroupsNamespaceResponse#rule_groups_namespace #rule_groups_namespace} => Types::RuleGroupsNamespaceDescription
629
+ #
630
+ # @example Request syntax with placeholder values
631
+ #
632
+ # resp = client.describe_rule_groups_namespace({
633
+ # name: "RuleGroupsNamespaceName", # required
634
+ # workspace_id: "WorkspaceId", # required
635
+ # })
636
+ #
637
+ # @example Response structure
638
+ #
639
+ # resp.rule_groups_namespace.arn #=> String
640
+ # resp.rule_groups_namespace.created_at #=> Time
641
+ # resp.rule_groups_namespace.data #=> String
642
+ # resp.rule_groups_namespace.modified_at #=> Time
643
+ # resp.rule_groups_namespace.name #=> String
644
+ # resp.rule_groups_namespace.status.status_code #=> String, one of "CREATING", "ACTIVE", "UPDATING", "DELETING", "CREATION_FAILED", "UPDATE_FAILED"
645
+ # resp.rule_groups_namespace.status.status_reason #=> String
646
+ # resp.rule_groups_namespace.tags #=> Hash
647
+ # resp.rule_groups_namespace.tags["TagKey"] #=> String
648
+ #
649
+ # @see http://docs.aws.amazon.com/goto/WebAPI/amp-2020-08-01/DescribeRuleGroupsNamespace AWS API Documentation
650
+ #
651
+ # @overload describe_rule_groups_namespace(params = {})
652
+ # @param [Hash] params ({})
653
+ def describe_rule_groups_namespace(params = {}, options = {})
654
+ req = build_request(:describe_rule_groups_namespace, params)
655
+ req.send_request(options)
656
+ end
657
+
410
658
  # Describes an existing AMP workspace.
411
659
  #
412
660
  # @option params [required, String] :workspace_id
@@ -433,6 +681,12 @@ module Aws::PrometheusService
433
681
  # resp.workspace.tags["TagKey"] #=> String
434
682
  # resp.workspace.workspace_id #=> String
435
683
  #
684
+ #
685
+ # The following waiters are defined for this operation (see {Client#wait_until} for detailed usage):
686
+ #
687
+ # * workspace_active
688
+ # * workspace_deleted
689
+ #
436
690
  # @see http://docs.aws.amazon.com/goto/WebAPI/amp-2020-08-01/DescribeWorkspace AWS API Documentation
437
691
  #
438
692
  # @overload describe_workspace(params = {})
@@ -442,6 +696,61 @@ module Aws::PrometheusService
442
696
  req.send_request(options)
443
697
  end
444
698
 
699
+ # Lists rule groups namespaces.
700
+ #
701
+ # @option params [Integer] :max_results
702
+ # Maximum results to return in response (default=100, maximum=1000).
703
+ #
704
+ # @option params [String] :name
705
+ # Optional filter for rule groups namespace name. Only the rule groups
706
+ # namespace that begin with this value will be returned.
707
+ #
708
+ # @option params [String] :next_token
709
+ # Pagination token to request the next page in a paginated list. This
710
+ # token is obtained from the output of the previous
711
+ # ListRuleGroupsNamespaces request.
712
+ #
713
+ # @option params [required, String] :workspace_id
714
+ # The ID of the workspace.
715
+ #
716
+ # @return [Types::ListRuleGroupsNamespacesResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
717
+ #
718
+ # * {Types::ListRuleGroupsNamespacesResponse#next_token #next_token} => String
719
+ # * {Types::ListRuleGroupsNamespacesResponse#rule_groups_namespaces #rule_groups_namespaces} => Array&lt;Types::RuleGroupsNamespaceSummary&gt;
720
+ #
721
+ # The returned {Seahorse::Client::Response response} is a pageable response and is Enumerable. For details on usage see {Aws::PageableResponse PageableResponse}.
722
+ #
723
+ # @example Request syntax with placeholder values
724
+ #
725
+ # resp = client.list_rule_groups_namespaces({
726
+ # max_results: 1,
727
+ # name: "RuleGroupsNamespaceName",
728
+ # next_token: "PaginationToken",
729
+ # workspace_id: "WorkspaceId", # required
730
+ # })
731
+ #
732
+ # @example Response structure
733
+ #
734
+ # resp.next_token #=> String
735
+ # resp.rule_groups_namespaces #=> Array
736
+ # resp.rule_groups_namespaces[0].arn #=> String
737
+ # resp.rule_groups_namespaces[0].created_at #=> Time
738
+ # resp.rule_groups_namespaces[0].modified_at #=> Time
739
+ # resp.rule_groups_namespaces[0].name #=> String
740
+ # resp.rule_groups_namespaces[0].status.status_code #=> String, one of "CREATING", "ACTIVE", "UPDATING", "DELETING", "CREATION_FAILED", "UPDATE_FAILED"
741
+ # resp.rule_groups_namespaces[0].status.status_reason #=> String
742
+ # resp.rule_groups_namespaces[0].tags #=> Hash
743
+ # resp.rule_groups_namespaces[0].tags["TagKey"] #=> String
744
+ #
745
+ # @see http://docs.aws.amazon.com/goto/WebAPI/amp-2020-08-01/ListRuleGroupsNamespaces AWS API Documentation
746
+ #
747
+ # @overload list_rule_groups_namespaces(params = {})
748
+ # @param [Hash] params ({})
749
+ def list_rule_groups_namespaces(params = {}, options = {})
750
+ req = build_request(:list_rule_groups_namespaces, params)
751
+ req.send_request(options)
752
+ end
753
+
445
754
  # Lists the tags you have assigned to the resource.
446
755
  #
447
756
  # @option params [required, String] :resource_arn
@@ -522,6 +831,100 @@ module Aws::PrometheusService
522
831
  req.send_request(options)
523
832
  end
524
833
 
834
+ # Update an alert manager definition.
835
+ #
836
+ # @option params [String] :client_token
837
+ # Optional, unique, case-sensitive, user-provided identifier to ensure
838
+ # the idempotency of the request.
839
+ #
840
+ # **A suitable default value is auto-generated.** You should normally
841
+ # not need to pass this option.**
842
+ #
843
+ # @option params [required, String, StringIO, File] :data
844
+ # The alert manager definition data.
845
+ #
846
+ # @option params [required, String] :workspace_id
847
+ # The ID of the workspace in which to update the alert manager
848
+ # definition.
849
+ #
850
+ # @return [Types::PutAlertManagerDefinitionResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
851
+ #
852
+ # * {Types::PutAlertManagerDefinitionResponse#status #status} => Types::AlertManagerDefinitionStatus
853
+ #
854
+ # @example Request syntax with placeholder values
855
+ #
856
+ # resp = client.put_alert_manager_definition({
857
+ # client_token: "IdempotencyToken",
858
+ # data: "data", # required
859
+ # workspace_id: "WorkspaceId", # required
860
+ # })
861
+ #
862
+ # @example Response structure
863
+ #
864
+ # resp.status.status_code #=> String, one of "CREATING", "ACTIVE", "UPDATING", "DELETING", "CREATION_FAILED", "UPDATE_FAILED"
865
+ # resp.status.status_reason #=> String
866
+ #
867
+ # @see http://docs.aws.amazon.com/goto/WebAPI/amp-2020-08-01/PutAlertManagerDefinition AWS API Documentation
868
+ #
869
+ # @overload put_alert_manager_definition(params = {})
870
+ # @param [Hash] params ({})
871
+ def put_alert_manager_definition(params = {}, options = {})
872
+ req = build_request(:put_alert_manager_definition, params)
873
+ req.send_request(options)
874
+ end
875
+
876
+ # Update a rule groups namespace.
877
+ #
878
+ # @option params [String] :client_token
879
+ # Optional, unique, case-sensitive, user-provided identifier to ensure
880
+ # the idempotency of the request.
881
+ #
882
+ # **A suitable default value is auto-generated.** You should normally
883
+ # not need to pass this option.**
884
+ #
885
+ # @option params [required, String, StringIO, File] :data
886
+ # The namespace data that define the rule groups.
887
+ #
888
+ # @option params [required, String] :name
889
+ # The rule groups namespace name.
890
+ #
891
+ # @option params [required, String] :workspace_id
892
+ # The ID of the workspace in which to update the rule group namespace.
893
+ #
894
+ # @return [Types::PutRuleGroupsNamespaceResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
895
+ #
896
+ # * {Types::PutRuleGroupsNamespaceResponse#arn #arn} => String
897
+ # * {Types::PutRuleGroupsNamespaceResponse#name #name} => String
898
+ # * {Types::PutRuleGroupsNamespaceResponse#status #status} => Types::RuleGroupsNamespaceStatus
899
+ # * {Types::PutRuleGroupsNamespaceResponse#tags #tags} => Hash&lt;String,String&gt;
900
+ #
901
+ # @example Request syntax with placeholder values
902
+ #
903
+ # resp = client.put_rule_groups_namespace({
904
+ # client_token: "IdempotencyToken",
905
+ # data: "data", # required
906
+ # name: "RuleGroupsNamespaceName", # required
907
+ # workspace_id: "WorkspaceId", # required
908
+ # })
909
+ #
910
+ # @example Response structure
911
+ #
912
+ # resp.arn #=> String
913
+ # resp.name #=> String
914
+ # resp.status.status_code #=> String, one of "CREATING", "ACTIVE", "UPDATING", "DELETING", "CREATION_FAILED", "UPDATE_FAILED"
915
+ # resp.status.status_reason #=> String
916
+ # resp.tags #=> Hash
917
+ # resp.tags["TagKey"] #=> String
918
+ #
919
+ # @see http://docs.aws.amazon.com/goto/WebAPI/amp-2020-08-01/PutRuleGroupsNamespace AWS API Documentation
920
+ #
921
+ # @overload put_rule_groups_namespace(params = {})
922
+ # @param [Hash] params ({})
923
+ def put_rule_groups_namespace(params = {}, options = {})
924
+ req = build_request(:put_rule_groups_namespace, params)
925
+ req.send_request(options)
926
+ end
927
+
525
928
  # Creates tags for the specified resource.
526
929
  #
527
930
  # @option params [required, String] :resource_arn
@@ -623,14 +1026,129 @@ module Aws::PrometheusService
623
1026
  params: params,
624
1027
  config: config)
625
1028
  context[:gem_name] = 'aws-sdk-prometheusservice'
626
- context[:gem_version] = '1.7.0'
1029
+ context[:gem_version] = '1.11.0'
627
1030
  Seahorse::Client::Request.new(handlers, context)
628
1031
  end
629
1032
 
1033
+ # Polls an API operation until a resource enters a desired state.
1034
+ #
1035
+ # ## Basic Usage
1036
+ #
1037
+ # A waiter will call an API operation until:
1038
+ #
1039
+ # * It is successful
1040
+ # * It enters a terminal state
1041
+ # * It makes the maximum number of attempts
1042
+ #
1043
+ # In between attempts, the waiter will sleep.
1044
+ #
1045
+ # # polls in a loop, sleeping between attempts
1046
+ # client.wait_until(waiter_name, params)
1047
+ #
1048
+ # ## Configuration
1049
+ #
1050
+ # You can configure the maximum number of polling attempts, and the
1051
+ # delay (in seconds) between each polling attempt. You can pass
1052
+ # configuration as the final arguments hash.
1053
+ #
1054
+ # # poll for ~25 seconds
1055
+ # client.wait_until(waiter_name, params, {
1056
+ # max_attempts: 5,
1057
+ # delay: 5,
1058
+ # })
1059
+ #
1060
+ # ## Callbacks
1061
+ #
1062
+ # You can be notified before each polling attempt and before each
1063
+ # delay. If you throw `:success` or `:failure` from these callbacks,
1064
+ # it will terminate the waiter.
1065
+ #
1066
+ # started_at = Time.now
1067
+ # client.wait_until(waiter_name, params, {
1068
+ #
1069
+ # # disable max attempts
1070
+ # max_attempts: nil,
1071
+ #
1072
+ # # poll for 1 hour, instead of a number of attempts
1073
+ # before_wait: -> (attempts, response) do
1074
+ # throw :failure if Time.now - started_at > 3600
1075
+ # end
1076
+ # })
1077
+ #
1078
+ # ## Handling Errors
1079
+ #
1080
+ # When a waiter is unsuccessful, it will raise an error.
1081
+ # All of the failure errors extend from
1082
+ # {Aws::Waiters::Errors::WaiterFailed}.
1083
+ #
1084
+ # begin
1085
+ # client.wait_until(...)
1086
+ # rescue Aws::Waiters::Errors::WaiterFailed
1087
+ # # resource did not enter the desired state in time
1088
+ # end
1089
+ #
1090
+ # ## Valid Waiters
1091
+ #
1092
+ # The following table lists the valid waiter names, the operations they call,
1093
+ # and the default `:delay` and `:max_attempts` values.
1094
+ #
1095
+ # | waiter_name | params | :delay | :max_attempts |
1096
+ # | ----------------- | --------------------------- | -------- | ------------- |
1097
+ # | workspace_active | {Client#describe_workspace} | 2 | 60 |
1098
+ # | workspace_deleted | {Client#describe_workspace} | 2 | 60 |
1099
+ #
1100
+ # @raise [Errors::FailureStateError] Raised when the waiter terminates
1101
+ # because the waiter has entered a state that it will not transition
1102
+ # out of, preventing success.
1103
+ #
1104
+ # @raise [Errors::TooManyAttemptsError] Raised when the configured
1105
+ # maximum number of attempts have been made, and the waiter is not
1106
+ # yet successful.
1107
+ #
1108
+ # @raise [Errors::UnexpectedError] Raised when an error is encounted
1109
+ # while polling for a resource that is not expected.
1110
+ #
1111
+ # @raise [Errors::NoSuchWaiterError] Raised when you request to wait
1112
+ # for an unknown state.
1113
+ #
1114
+ # @return [Boolean] Returns `true` if the waiter was successful.
1115
+ # @param [Symbol] waiter_name
1116
+ # @param [Hash] params ({})
1117
+ # @param [Hash] options ({})
1118
+ # @option options [Integer] :max_attempts
1119
+ # @option options [Integer] :delay
1120
+ # @option options [Proc] :before_attempt
1121
+ # @option options [Proc] :before_wait
1122
+ def wait_until(waiter_name, params = {}, options = {})
1123
+ w = waiter(waiter_name, options)
1124
+ yield(w.waiter) if block_given? # deprecated
1125
+ w.wait(params)
1126
+ end
1127
+
630
1128
  # @api private
631
1129
  # @deprecated
632
1130
  def waiter_names
633
- []
1131
+ waiters.keys
1132
+ end
1133
+
1134
+ private
1135
+
1136
+ # @param [Symbol] waiter_name
1137
+ # @param [Hash] options ({})
1138
+ def waiter(waiter_name, options = {})
1139
+ waiter_class = waiters[waiter_name]
1140
+ if waiter_class
1141
+ waiter_class.new(options.merge(client: self))
1142
+ else
1143
+ raise Aws::Waiters::Errors::NoSuchWaiterError.new(waiter_name, waiters.keys)
1144
+ end
1145
+ end
1146
+
1147
+ def waiters
1148
+ {
1149
+ workspace_active: Waiters::WorkspaceActive,
1150
+ workspace_deleted: Waiters::WorkspaceDeleted
1151
+ }
634
1152
  end
635
1153
 
636
1154
  class << self