glazed-aws 0.3.0 → 0.4.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
  SHA256:
3
- metadata.gz: 9303974bece5c260c19b78a342a9a90df7a7e7cf3cb57c11a525d5a8c9a354ce
4
- data.tar.gz: 5b18d3dcb362c3714bb635bfd2a4bf7379f779b114ac78be51c994af1becd96a
3
+ metadata.gz: 16040352b7a00bb26d3e541ecc85b7c63df19f00d1320bd207667b67996d6350
4
+ data.tar.gz: 310039d2e8a38cece047832810a90673829a9844e5be4283b71682a396433378
5
5
  SHA512:
6
- metadata.gz: e6f48156a90b5e6b52dd48c1258efbb4aa58f3ed7ef191f56c93672c09034fdcca67284ff2186af154a96abc1aa4ec6777476308db5be22c8c86f42f60614eb0
7
- data.tar.gz: 59f9d749908fa550fa35bf6e413022c499a5a6a51fa03b94fe7d0062911fa693af6cf5eb388df9e06d0299aa9d57cfdc692902fda1dd3609167c86cd9bf87bbe
6
+ metadata.gz: 239ee1c952aa96bd86dc6ccee5a628c5b39925224d8d8fb5da7d811175f88bc1662288e19adfbe6705d8e060074a6a9968cfb13151001330c36377f0f27af658
7
+ data.tar.gz: c936b154cb27b34c75c2b5999cc60e9621af934409771534adfb1e64b292a9e68a20c8cfc5331dd1959e0f463c6afbf90cc641bc516ec6896673b5d544f3d959
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [0.4.0] - 2026-10-18
2
+
3
+ ### Breaking changes
4
+
5
+ - `ssm` secrets take `cache` as a duration such as `"300s"` in place of `cache_seconds`. Generate the state machine definition again: Check passes `grace` as a duration in place of `grace_seconds`
6
+
1
7
  ## [0.3.0] - 2026-10-17
2
8
 
3
9
  ### Breaking changes
@@ -88,7 +88,7 @@ module Glazed
88
88
  'Check' => invoke(
89
89
  {'check' => {
90
90
  'token' => '{% $states.context.Execution.Id %}', 'cycle' => '{% $cycle %}',
91
- 'grace_seconds' => @grace_seconds || 0, 'max_cycles' => @max_cycles || 0,
91
+ 'grace' => "#{@grace_seconds || 0}s", 'max_cycles' => @max_cycles || 0,
92
92
  }},
93
93
  execution_input: '{% $cycle = 0 ? $states.context.Execution.Input : null %}',
94
94
  ).merge('Retry' => [retry_on(LAMBDA_ERRORS + ['States.TaskFailed'])], 'Next' => 'Armed?'),
@@ -6,6 +6,6 @@
6
6
  module Glazed
7
7
  module Aws
8
8
  # Gem version.
9
- VERSION = '0.3.0' #: String
9
+ VERSION = '0.4.0' #: String
10
10
  end
11
11
  end
@@ -8,6 +8,7 @@ require 'glazed/must'
8
8
  require 'glazed/proto'
9
9
  require 'glazed/secret'
10
10
  require 'glazed/secrets'
11
+ require 'glazed/durations'
11
12
 
12
13
  module Glazed
13
14
  # Namespace of secret sources; glazed-aws adds {Ssm}.
@@ -24,15 +25,15 @@ module Glazed
24
25
 
25
26
  # @param name [String] name or ARN of the parameter
26
27
  # @param region [String, nil] region of the parameter; the SDK default when nil
27
- # @param cache_seconds [Integer] seconds a fetched value is reused
28
+ # @param cache_seconds [Numeric] seconds a fetched value is reused
28
29
  # @param client [Aws::SSM::Client, nil] client to use instead of building one
29
30
  # @param clock [Proc] returns monotonic seconds
30
- #: (name: String, ?region: String?, ?cache_seconds: Integer, ?client: ::Aws::SSM::Client?, ?clock: ^() -> Float) -> void
31
+ #: (name: String, ?region: String?, ?cache_seconds: Numeric, ?client: ::Aws::SSM::Client?, ?clock: ^() -> Float) -> void
31
32
  def initialize(name:, region: nil, cache_seconds: DEFAULT_CACHE_SECONDS, client: nil, clock: -> { Process.clock_gettime(Process::CLOCK_MONOTONIC).to_f })
32
33
  super()
33
34
  @name = name #: String
34
35
  @region = region #: String?
35
- @cache_seconds = cache_seconds #: Integer
36
+ @cache_seconds = cache_seconds #: Numeric
36
37
  @client = client #: ::Aws::SSM::Client?
37
38
  @clock = clock #: ^() -> Float
38
39
  @value = nil #: String?
@@ -51,7 +52,7 @@ module Glazed
51
52
  new(
52
53
  name: ssm.name,
53
54
  region: ssm.region.empty? ? nil : ssm.region,
54
- cache_seconds: ssm.cache_seconds.zero? ? DEFAULT_CACHE_SECONDS : ssm.cache_seconds,
55
+ cache_seconds: Durations.seconds(ssm.cache, DEFAULT_CACHE_SECONDS),
55
56
  )
56
57
  end
57
58
 
@@ -68,7 +69,7 @@ module Glazed
68
69
  now = @clock.call
69
70
  cached = @value
70
71
  fetched_at = @fetched_at
71
- return cached if cached && fetched_at && now - fetched_at < @cache_seconds
72
+ return cached if cached && fetched_at && now - fetched_at < @cache_seconds.to_f
72
73
 
73
74
  fetch.tap do |fetched|
74
75
  @value = fetched
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glazed-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sorah Fukumori
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 0.3.0
18
+ version: 0.4.0
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: 0.3.0
25
+ version: 0.4.0
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: aws-sdk-s3
28
28
  requirement: !ruby/object:Gem::Requirement