aws-sdk-eks 1.6.0 → 1.7.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: acd71209662da0200dc462994612b69f194e1d67
4
- data.tar.gz: ead2b48adf2a2cf519b66cd99405ec9be8afc5e2
3
+ metadata.gz: 6e6501a7fd69fb4aca55abae8f5d9218de0cfe4f
4
+ data.tar.gz: 367c95765e61b789a2424ce419d9ba6f7c999499
5
5
  SHA512:
6
- metadata.gz: 97e8cf8c3c85a50cac6eb028778de7edf798ceb7a59bb9cce1ed9e83129070d57891b8e9979e534a8ab8d30084d0e0087e59e85ec144d83fe4148a2047511d52
7
- data.tar.gz: 5c1bf38175717be2eb3d4f555b50927c2a5c8f918a1792d8f81a0a56961e9a09e30b72786009d0bc6d6f1389f10b2d8499d8b9f31019b105c6d6cda496429b9c
6
+ metadata.gz: add8eeeee03112f988e3efe9fd29688d1a2a13f63ade2c309bb065056b39610f50e25590b32570b04cc04c75e2cce11cd3549e728aed3d3b238ab6240bae204c
7
+ data.tar.gz: 574f1a627d9bb835511455f83323d3d2f577bce607664db9c01fde47c2dc2f38fd34c88edd6980526b41e22c655383b769c1195d9f466b6314116dc97ccb4f26
data/lib/aws-sdk-eks.rb CHANGED
@@ -12,6 +12,7 @@ require_relative 'aws-sdk-eks/types'
12
12
  require_relative 'aws-sdk-eks/client_api'
13
13
  require_relative 'aws-sdk-eks/client'
14
14
  require_relative 'aws-sdk-eks/errors'
15
+ require_relative 'aws-sdk-eks/waiters'
15
16
  require_relative 'aws-sdk-eks/resource'
16
17
  require_relative 'aws-sdk-eks/customizations'
17
18
 
@@ -42,6 +43,6 @@ require_relative 'aws-sdk-eks/customizations'
42
43
  # @service
43
44
  module Aws::EKS
44
45
 
45
- GEM_VERSION = '1.6.0'
46
+ GEM_VERSION = '1.7.0'
46
47
 
47
48
  end
@@ -554,14 +554,129 @@ module Aws::EKS
554
554
  params: params,
555
555
  config: config)
556
556
  context[:gem_name] = 'aws-sdk-eks'
557
- context[:gem_version] = '1.6.0'
557
+ context[:gem_version] = '1.7.0'
558
558
  Seahorse::Client::Request.new(handlers, context)
559
559
  end
560
560
 
561
+ # Polls an API operation until a resource enters a desired state.
562
+ #
563
+ # ## Basic Usage
564
+ #
565
+ # A waiter will call an API operation until:
566
+ #
567
+ # * It is successful
568
+ # * It enters a terminal state
569
+ # * It makes the maximum number of attempts
570
+ #
571
+ # In between attempts, the waiter will sleep.
572
+ #
573
+ # # polls in a loop, sleeping between attempts
574
+ # client.waiter_until(waiter_name, params)
575
+ #
576
+ # ## Configuration
577
+ #
578
+ # You can configure the maximum number of polling attempts, and the
579
+ # delay (in seconds) between each polling attempt. You can pass
580
+ # configuration as the final arguments hash.
581
+ #
582
+ # # poll for ~25 seconds
583
+ # client.wait_until(waiter_name, params, {
584
+ # max_attempts: 5,
585
+ # delay: 5,
586
+ # })
587
+ #
588
+ # ## Callbacks
589
+ #
590
+ # You can be notified before each polling attempt and before each
591
+ # delay. If you throw `:success` or `:failure` from these callbacks,
592
+ # it will terminate the waiter.
593
+ #
594
+ # started_at = Time.now
595
+ # client.wait_until(waiter_name, params, {
596
+ #
597
+ # # disable max attempts
598
+ # max_attempts: nil,
599
+ #
600
+ # # poll for 1 hour, instead of a number of attempts
601
+ # before_wait: -> (attempts, response) do
602
+ # throw :failure if Time.now - started_at > 3600
603
+ # end
604
+ # })
605
+ #
606
+ # ## Handling Errors
607
+ #
608
+ # When a waiter is unsuccessful, it will raise an error.
609
+ # All of the failure errors extend from
610
+ # {Aws::Waiters::Errors::WaiterFailed}.
611
+ #
612
+ # begin
613
+ # client.wait_until(...)
614
+ # rescue Aws::Waiters::Errors::WaiterFailed
615
+ # # resource did not enter the desired state in time
616
+ # end
617
+ #
618
+ # ## Valid Waiters
619
+ #
620
+ # The following table lists the valid waiter names, the operations they call,
621
+ # and the default `:delay` and `:max_attempts` values.
622
+ #
623
+ # | waiter_name | params | :delay | :max_attempts |
624
+ # | --------------- | ------------------- | -------- | ------------- |
625
+ # | cluster_active | {#describe_cluster} | 30 | 40 |
626
+ # | cluster_deleted | {#describe_cluster} | 30 | 40 |
627
+ #
628
+ # @raise [Errors::FailureStateError] Raised when the waiter terminates
629
+ # because the waiter has entered a state that it will not transition
630
+ # out of, preventing success.
631
+ #
632
+ # @raise [Errors::TooManyAttemptsError] Raised when the configured
633
+ # maximum number of attempts have been made, and the waiter is not
634
+ # yet successful.
635
+ #
636
+ # @raise [Errors::UnexpectedError] Raised when an error is encounted
637
+ # while polling for a resource that is not expected.
638
+ #
639
+ # @raise [Errors::NoSuchWaiterError] Raised when you request to wait
640
+ # for an unknown state.
641
+ #
642
+ # @return [Boolean] Returns `true` if the waiter was successful.
643
+ # @param [Symbol] waiter_name
644
+ # @param [Hash] params ({})
645
+ # @param [Hash] options ({})
646
+ # @option options [Integer] :max_attempts
647
+ # @option options [Integer] :delay
648
+ # @option options [Proc] :before_attempt
649
+ # @option options [Proc] :before_wait
650
+ def wait_until(waiter_name, params = {}, options = {})
651
+ w = waiter(waiter_name, options)
652
+ yield(w.waiter) if block_given? # deprecated
653
+ w.wait(params)
654
+ end
655
+
561
656
  # @api private
562
657
  # @deprecated
563
658
  def waiter_names
564
- []
659
+ waiters.keys
660
+ end
661
+
662
+ private
663
+
664
+ # @param [Symbol] waiter_name
665
+ # @param [Hash] options ({})
666
+ def waiter(waiter_name, options = {})
667
+ waiter_class = waiters[waiter_name]
668
+ if waiter_class
669
+ waiter_class.new(options.merge(client: self))
670
+ else
671
+ raise Aws::Waiters::Errors::NoSuchWaiterError.new(waiter_name, waiters.keys)
672
+ end
673
+ end
674
+
675
+ def waiters
676
+ {
677
+ cluster_active: Waiters::ClusterActive,
678
+ cluster_deleted: Waiters::ClusterDeleted
679
+ }
565
680
  end
566
681
 
567
682
  class << self
@@ -0,0 +1,112 @@
1
+ # WARNING ABOUT GENERATED CODE
2
+ #
3
+ # This file is generated. See the contributing guide for more information:
4
+ # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
+ #
6
+ # WARNING ABOUT GENERATED CODE
7
+
8
+ require 'aws-sdk-core/waiters'
9
+
10
+ module Aws::EKS
11
+ module Waiters
12
+
13
+ class ClusterActive
14
+
15
+ # @param [Hash] options
16
+ # @option options [required, Client] :client
17
+ # @option options [Integer] :max_attempts (40)
18
+ # @option options [Integer] :delay (30)
19
+ # @option options [Proc] :before_attempt
20
+ # @option options [Proc] :before_wait
21
+ def initialize(options)
22
+ @client = options.fetch(:client)
23
+ @waiter = Aws::Waiters::Waiter.new({
24
+ max_attempts: 40,
25
+ delay: 30,
26
+ poller: Aws::Waiters::Poller.new(
27
+ operation_name: :describe_cluster,
28
+ acceptors: [
29
+ {
30
+ "expected" => "DELETING",
31
+ "matcher" => "path",
32
+ "state" => "failure",
33
+ "argument" => "cluster.status"
34
+ },
35
+ {
36
+ "expected" => "FAILED",
37
+ "matcher" => "path",
38
+ "state" => "failure",
39
+ "argument" => "cluster.status"
40
+ },
41
+ {
42
+ "expected" => "ACTIVE",
43
+ "matcher" => "path",
44
+ "state" => "success",
45
+ "argument" => "cluster.status"
46
+ }
47
+ ]
48
+ )
49
+ }.merge(options))
50
+ end
51
+
52
+ # @option (see Client#describe_cluster)
53
+ # @return (see Client#describe_cluster)
54
+ def wait(params = {})
55
+ @waiter.wait(client: @client, params: params)
56
+ end
57
+
58
+ # @api private
59
+ attr_reader :waiter
60
+
61
+ end
62
+
63
+ class ClusterDeleted
64
+
65
+ # @param [Hash] options
66
+ # @option options [required, Client] :client
67
+ # @option options [Integer] :max_attempts (40)
68
+ # @option options [Integer] :delay (30)
69
+ # @option options [Proc] :before_attempt
70
+ # @option options [Proc] :before_wait
71
+ def initialize(options)
72
+ @client = options.fetch(:client)
73
+ @waiter = Aws::Waiters::Waiter.new({
74
+ max_attempts: 40,
75
+ delay: 30,
76
+ poller: Aws::Waiters::Poller.new(
77
+ operation_name: :describe_cluster,
78
+ acceptors: [
79
+ {
80
+ "expected" => "ACTIVE",
81
+ "matcher" => "path",
82
+ "state" => "failure",
83
+ "argument" => "cluster.status"
84
+ },
85
+ {
86
+ "expected" => "CREATING",
87
+ "matcher" => "path",
88
+ "state" => "failure",
89
+ "argument" => "cluster.status"
90
+ },
91
+ {
92
+ "expected" => "ResourceNotFoundException",
93
+ "matcher" => "error",
94
+ "state" => "success"
95
+ }
96
+ ]
97
+ )
98
+ }.merge(options))
99
+ end
100
+
101
+ # @option (see Client#describe_cluster)
102
+ # @return (see Client#describe_cluster)
103
+ def wait(params = {})
104
+ @waiter.wait(client: @client, params: params)
105
+ end
106
+
107
+ # @api private
108
+ attr_reader :waiter
109
+
110
+ end
111
+ end
112
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-eks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-24 00:00:00.000000000 Z
11
+ date: 2018-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-core
@@ -59,6 +59,7 @@ files:
59
59
  - lib/aws-sdk-eks/errors.rb
60
60
  - lib/aws-sdk-eks/resource.rb
61
61
  - lib/aws-sdk-eks/types.rb
62
+ - lib/aws-sdk-eks/waiters.rb
62
63
  homepage: http://github.com/aws/aws-sdk-ruby
63
64
  licenses:
64
65
  - Apache-2.0