concourse-objects 1.15.2

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,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../concourse-objects"
4
+
5
+ module ConcourseObjects
6
+ module Resources
7
+ class Pool < Resource
8
+ RESOURCE_NAME = "pool"
9
+ GITHUB_OWNER = "concourse"
10
+ GITHUB_REPOSITORY = "concourse/pool-resource"
11
+ GITHUB_VERSION = "v1.0.3"
12
+
13
+ class Source < Object
14
+ DEFAULT_RETRY_DELAY = "10s"
15
+
16
+ required :uri, write: AsString
17
+ required :branch, write: AsString
18
+ required :pool, write: AsString
19
+
20
+ optional :private_key, write: AsString
21
+ optional :username, write: AsString
22
+ optional :password, write: AsString
23
+ optional :retry_delay, write: AsString, default: proc { DEFAULT_RETRY_DELAY }
24
+ end
25
+
26
+ class InParams < Object
27
+ ValueIsPositive = proc { |_, value| value.positive? }
28
+
29
+ optional :depth, write: AsInteger, guard: ValueIsPositive
30
+ end
31
+
32
+ class OutParams < Object
33
+ optional :acquire, write: AsBoolean
34
+ optional :claim, write: AsString
35
+ optional :release, write: AsString
36
+ optional :add, write: AsString
37
+ optional :add_claimed, write: AsString
38
+ optional :remove, write: AsString
39
+ optional :update, write: AsString
40
+
41
+ def initialize(options = {})
42
+ super(options) do |this, options|
43
+ raise KeyError, "expected one of: (#{self.class.optional_attributes.inspect})" unless self.class.optional_attributes.any? { |key| options.key?(key) }
44
+
45
+ yield this, options if block_given?
46
+ end
47
+ end
48
+ end
49
+
50
+ optional :source, write: Source
51
+
52
+ def initialize(options = {})
53
+ super(options.merge(type: "pool")) do |this, options|
54
+ yield this, options if block_given?
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../concourse-objects"
4
+
5
+ module ConcourseObjects
6
+ module Resources
7
+ class RegistryImage < Resource
8
+ RESOURCE_NAME = "registry-image"
9
+ GITHUB_OWNER = "concourse"
10
+ GITHUB_REPOSITORY = "concourse/registry-image-resource"
11
+ GITHUB_VERSION = "v0.6.1"
12
+
13
+ class Source < Object
14
+ DEFAULT_DEBUG = false
15
+ DEFAULT_TAG = "latest"
16
+
17
+ required :repository, write: AsString
18
+
19
+ optional :username, write: AsString
20
+ optional :password, write: AsString
21
+ optional :tag, write: AsString, default: proc { DEFAULT_TAG }
22
+ optional :debug, write: AsBoolean, default: proc { DEFAULT_DEBUG }
23
+ end
24
+
25
+ class InParams < Object
26
+ DEFAULT_FORMAT = "rootfs"
27
+ ACCEPTABLE_FORMATS = ["rootfs", "oci"]
28
+
29
+ FormatIsAcceptable = proc { |_, format| ACCEPTABLE_FORMATS.include?(format) }
30
+
31
+ optional :format, write: AsString, default: proc { DEFAULT_FORMAT }, guard: FormatIsAcceptable
32
+ end
33
+
34
+ class OutParams < Object
35
+ required :image, write: AsString
36
+
37
+ optional :additional_tags, write: AsArrayOf.(:to_s), default: EmptyArray
38
+ end
39
+
40
+ optional :source, write: Source
41
+
42
+ def initialize(options = {})
43
+ super(options.merge(type: "registry-image")) do |this, options|
44
+ yield this, options if block_given?
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../concourse-objects"
4
+
5
+ module ConcourseObjects
6
+ module Resources
7
+ class S3 < Resource
8
+ RESOURCE_NAME = "s3"
9
+ GITHUB_OWNER = "concourse"
10
+ GITHUB_REPOSITORY = "concourse/s3-resource"
11
+ GITHUB_VERSION = "v1.0.3"
12
+
13
+ class Source < Object
14
+ DEFAULT_SKIP_SSL_VERIFICATION = false
15
+ DEFAULT_DISABLE_MULTIPART = false
16
+ DEFAULT_DISABLE_SSL = false
17
+ DEFAULT_SKIP_DOWNLOAD = false
18
+ DEFAULT_USE_V2_SIGNING = false
19
+ DEFAULT_PRIVATE = false
20
+ DEFAULT_REGION_NAME = "us-east-1"
21
+
22
+ HasRegexp = proc { |source| source.regexp? }
23
+ HasVersionedFile = proc { |source| source.versioned_file?}
24
+ HasInitialState = proc { |source| source.regexp? or source.versioned_file? }
25
+
26
+ required :bucket, write: AsString
27
+
28
+ optional :private, write: AsBoolean, default: proc { DEFAULT_PRIVATE }
29
+ optional :disable_ssl, write: AsBoolean, default: proc { DEFAULT_DISABLE_SSL }
30
+ optional :skip_ssl_verification, write: AsBoolean, default: proc { DEFAULT_SKIP_SSL_VERIFICATION }
31
+ optional :skip_download, write: AsBoolean, default: proc { DEFAULT_SKIP_DOWNLOAD }
32
+ optional :use_v2_signing, write: AsBoolean, default: proc { DEFAULT_USE_V2_SIGNING }
33
+ optional :disable_multipart, write: AsBoolean, default: proc { DEFAULT_DISABLE_MULTIPART }
34
+ optional :region_name, write: AsString, default: proc { DEFAULT_REGION_NAME }
35
+ optional :initial_path, write: AsString, guard: HasRegexp
36
+ optional :initial_version, write: AsString, guard: HasVersionedFile
37
+ optional :initial_content_text, write: AsString, guard: HasInitialState
38
+ optional :initial_content_binary, write: AsString, guard: HasInitialState
39
+ optional :regexp, write: AsString
40
+ optional :versioned_file, write: AsString
41
+ optional :access_key_id, write: AsString
42
+ optional :secret_access_key, write: AsString
43
+ optional :session_token, write: AsString
44
+ optional :cloudfront_url, write: AsString
45
+ optional :endpoint, write: AsString
46
+ optional :server_side_encryption, write: AsString
47
+ optional :sse_kms_key_id, write: AsString
48
+
49
+ def initialize(options = {})
50
+ super(options)
51
+ super(options) do |this, options|
52
+ raise KeyError, "expected one of (regexp, versioned_file), got both" if (this.regexp? and this.versioned_file?)
53
+
54
+ yield this, options if block_given?
55
+ end
56
+ end
57
+ end
58
+
59
+ class InParams < Object
60
+ DEFAULT_SKIP_DOWNLOAD = false
61
+ DEFAULT_UNPACK = true
62
+
63
+ optional :skip_download, write: AsBoolean, default: proc { DEFAULT_SKIP_DOWNLOAD }
64
+ optional :unpack, write: AsBoolean, default: proc { DEFAULT_UNPACK }
65
+ end
66
+
67
+ class OutParams < Object
68
+ required :file, write: AsString
69
+
70
+ optional :acl, write: AsString
71
+ optional :content_type, write: AsString
72
+ end
73
+
74
+ optional :source, write: Source
75
+
76
+ def initialize(options = {})
77
+ super(options.merge(type: "s3")) do |this, options|
78
+ yield this, options if block_given?
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,135 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../concourse-objects"
4
+
5
+ module ConcourseObjects
6
+ module Resources
7
+ class SemVer < Resource
8
+ RESOURCE_NAME = "semver"
9
+ GITHUB_OWNER = "concourse"
10
+ GITHUB_REPOSITORY = "concourse/semver-resource"
11
+ GITHUB_VERSION = "v1.0.2"
12
+
13
+ class Source < Object
14
+ DEFAULT_DRIVER = "s3"
15
+ ACCEPTABLE_DRIVERS = ["git", "s3", "swift", "gcs"]
16
+ DriverIsAcceptable = proc { |_, driver| ACCEPTABLE_DRIVERS.include?(driver) }
17
+
18
+ optional :initial_version, write: AsString
19
+ optional :driver, write: AsString, guard: DriverIsAcceptable
20
+
21
+ class Git < Source
22
+ DEFAULT_SKIP_SSL_VERIFICATION = false
23
+
24
+ ValueIsPositive = proc { |_, value| value.positive? }
25
+
26
+ required :uri, write: AsString
27
+ required :branch, write: AsString
28
+ required :file, write: AsString
29
+
30
+ optional :depth, write: AsInteger, guard: ValueIsPositive
31
+ optional :skip_ssl_verification, write: AsBoolean, default: proc { DEFAULT_SKIP_SSL_VERIFICATION }
32
+ optional :private_key, write: AsString
33
+ optional :username, write: AsString
34
+ optional :password, write: AsString
35
+ optional :git_user, write: AsString
36
+ optional :commit_message, write: AsString
37
+
38
+ def initialize(options = {})
39
+ super(options.merge(driver: "git")) do |this, options|
40
+ yield this, options if block_given?
41
+ end
42
+ end
43
+ end
44
+
45
+ class S3 < Source
46
+ DEFAULT_USE_V2_SIGNING = false
47
+ DEFAULT_DISABLE_SSL = false
48
+ DEFAULT_SKIP_SSL_VERIFICATION = false
49
+ DEFAULT_REGION_NAME = "us-east-1"
50
+
51
+ required :bucket, write: AsString
52
+ required :key, write: AsString
53
+ required :access_key_id, write: AsString
54
+ required :secret_access_key, write: AsString
55
+
56
+ optional :disable_ssl, write: AsBoolean, default: proc { DEFAULT_DISABLE_SSL }
57
+ optional :skip_ssl_verification, write: AsBoolean, default: proc { DEFAULT_SKIP_SSL_VERIFICATION }
58
+ optional :use_v2_signing, write: AsBoolean, default: proc { DEFAULT_USE_V2_SIGNING }
59
+ optional :region_name, write: AsString, default: proc { DEFAULT_REGION_NAME }
60
+ optional :endpoint, write: AsString
61
+ optional :server_side_encryption, write: AsString
62
+
63
+ def initialize(options = {})
64
+ super(options.merge(driver: "s3")) do |this, options|
65
+ yield this, options if block_given?
66
+ end
67
+ end
68
+ end
69
+
70
+ class Swift < Source
71
+ class OpenStack < Object
72
+ DEFAULT_ALLOW_REAUTH = false
73
+
74
+ required :container, write: AsString
75
+ required :item_name, write: AsString
76
+ required :region, write: AsString
77
+
78
+ optional :allow_reauth, write: AsBoolean, default: proc { DEFAULT_ALLOW_REAUTH }
79
+ optional :identity_endpoint, write: AsString
80
+ optional :username, write: AsString
81
+ optional :user_id, write: AsString
82
+ optional :password, write: AsString
83
+ optional :api_key, write: AsString
84
+ optional :domain_id, write: AsString
85
+ optional :tenant_id, write: AsString
86
+ optional :tenant_name, write: AsString
87
+ optional :token_id, write: AsString
88
+ end
89
+
90
+ required :openstack, write: OpenStack
91
+
92
+ def initialize(options = {})
93
+ super(options.merge(driver: "swift")) do |this, options|
94
+ yield this, options if block_given?
95
+ end
96
+ end
97
+ end
98
+
99
+ class GCS < Source
100
+ required :bucket, write: AsString
101
+ required :key, write: AsString
102
+ required :json_key, write: AsString
103
+
104
+ def initialize(options = {})
105
+ super(options.merge(driver: "gcs")) do |this, options|
106
+ yield this, options if block_given?
107
+ end
108
+ end
109
+ end
110
+ end
111
+
112
+ optional :source, write: Source, default: proc { Source.new }
113
+
114
+ def initialize(options = {})
115
+ super(options.merge(type: "semver")) do |this, options|
116
+ if this.source?
117
+ options.fetch(:source).yield_self do |source|
118
+ case this.source.driver
119
+ when "git" then Source::Git.(source)
120
+ when "s3" then Source::S3.(source)
121
+ when "swift" then Source::Swift.(source)
122
+ when "gcs" then Source::GCS.(source)
123
+ else Source.(source)
124
+ end.yield_self do |source|
125
+ this.send(:instance_variable_set, :@source, source)
126
+ end
127
+ end
128
+ end
129
+
130
+ yield this, options if block_given?
131
+ end
132
+ end
133
+ end
134
+ end
135
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../concourse-objects"
4
+
5
+ module ConcourseObjects
6
+ module Resources
7
+ class Time < Resource
8
+ RESOURCE_NAME = "time"
9
+ GITHUB_OWNER = "concourse"
10
+ GITHUB_REPOSITORY = "concourse/time-resource"
11
+ GITHUB_VERSION = "v1.2.1"
12
+
13
+ class Source < Object
14
+ DEFAULT_LOCATION = "UTC"
15
+
16
+ optional :interval, write: AsString
17
+ optional :start, write: AsString
18
+ optional :stop, write: AsString
19
+ optional :location, write: AsString, default: proc { DEFAULT_LOCATION }
20
+ optional :days, write: AsArrayOf.(:to_s), default: EmptyArray
21
+ end
22
+ optional :source, write: Source
23
+
24
+ def initialize(options = {})
25
+ super(options.merge(type: "time"))
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "resources/bosh-io-release"
4
+ require_relative "resources/bosh-io-stemcell"
5
+ require_relative "resources/cf"
6
+ require_relative "resources/docker-image"
7
+ require_relative "resources/git"
8
+ require_relative "resources/github-release"
9
+ require_relative "resources/hg"
10
+ require_relative "resources/pool"
11
+ require_relative "resources/registry-image"
12
+ require_relative "resources/s3"
13
+ require_relative "resources/time"
14
+
15
+ module ConcourseObjects
16
+ module Resources
17
+ def self.resources
18
+ constants(false).map do |constant|
19
+ const_get(constant)
20
+ end
21
+ end
22
+
23
+ def self.owned_resources
24
+ resources.select do |resource|
25
+ resource.const_defined?(:GITHUB_OWNER)
26
+ end
27
+ end
28
+
29
+ def self.named_resources
30
+ resources.select do |resource|
31
+ resource.const_defined?(:RESOURCE_NAME)
32
+ end
33
+ end
34
+
35
+ def self.find(name)
36
+ named_resources.find do |resource|
37
+ name === resource.const_get(:RESOURCE_NAME)
38
+ end
39
+ end
40
+
41
+ def self.named(name)
42
+ named_resources.select do |resource|
43
+ name === resource.const_get(:RESOURCE_NAME)
44
+ end
45
+ end
46
+
47
+ def self.owners
48
+ resources.group_by do |resource|
49
+ resource.const_get(:GITHUB_OWNER) if resource.const_defined?(:GITHUB_OWNER)
50
+ end
51
+ end
52
+
53
+ def self.owned_by(owner)
54
+ owned_resources.select do |resource|
55
+ owner === resource.const_get(:GITHUB_OWNER)
56
+ end
57
+ end
58
+ end
59
+ end