cloudsmith-api 2.0.31 → 2.0.33

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 (264) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +15 -4
  4. data/build.json +1 -1
  5. data/docs/AlpinePackageUpload.md +1 -2
  6. data/docs/AlpinePackageUploadRequest.md +0 -2
  7. data/docs/CargoPackageUpload.md +1 -2
  8. data/docs/CargoPackageUploadRequest.md +0 -2
  9. data/docs/CocoapodsPackageUpload.md +1 -2
  10. data/docs/CocoapodsPackageUploadRequest.md +0 -2
  11. data/docs/ComposerPackageUpload.md +1 -2
  12. data/docs/ComposerPackageUploadRequest.md +0 -2
  13. data/docs/ConanPackageUpload.md +1 -2
  14. data/docs/ConanPackageUploadRequest.md +0 -2
  15. data/docs/CondaPackageUpload.md +1 -2
  16. data/docs/CondaPackageUploadRequest.md +0 -2
  17. data/docs/ConnectedRepository.md +3 -0
  18. data/docs/ConnectedRepositoryTargetSummary.md +11 -0
  19. data/docs/ConnectedRepositoryUpstream.md +9 -0
  20. data/docs/CranPackageUpload.md +1 -2
  21. data/docs/CranPackageUploadRequest.md +0 -2
  22. data/docs/DartPackageUpload.md +1 -2
  23. data/docs/DartPackageUploadRequest.md +0 -2
  24. data/docs/DebPackageUpload.md +1 -2
  25. data/docs/DebPackageUploadRequest.md +0 -2
  26. data/docs/DockerPackageUpload.md +1 -2
  27. data/docs/DockerPackageUploadRequest.md +0 -2
  28. data/docs/GenericPackageUpload.md +1 -2
  29. data/docs/GenericPackageUploadRequest.md +0 -2
  30. data/docs/GoPackageUpload.md +1 -2
  31. data/docs/GoPackageUploadRequest.md +0 -2
  32. data/docs/HelmPackageUpload.md +1 -2
  33. data/docs/HelmPackageUploadRequest.md +0 -2
  34. data/docs/HexPackageUpload.md +1 -2
  35. data/docs/HexPackageUploadRequest.md +0 -2
  36. data/docs/HuggingfacePackageUpload.md +1 -2
  37. data/docs/HuggingfacePackageUploadRequest.md +0 -2
  38. data/docs/LuarocksPackageUpload.md +1 -2
  39. data/docs/LuarocksPackageUploadRequest.md +0 -2
  40. data/docs/MavenPackageUpload.md +1 -2
  41. data/docs/MavenPackageUploadRequest.md +0 -2
  42. data/docs/McpPackageUpload.md +1 -2
  43. data/docs/McpPackageUploadRequest.md +0 -2
  44. data/docs/NixPackageUpload.md +1 -2
  45. data/docs/NixPackageUploadRequest.md +0 -2
  46. data/docs/NpmPackageUpload.md +1 -2
  47. data/docs/NpmPackageUploadRequest.md +0 -2
  48. data/docs/NugetPackageUpload.md +1 -2
  49. data/docs/NugetPackageUploadRequest.md +0 -2
  50. data/docs/OrganizationApiKeyRule.md +16 -0
  51. data/docs/OrganizationApiKeyRuleRequest.md +12 -0
  52. data/docs/OrganizationApiKeyRuleRequestPatch.md +12 -0
  53. data/docs/OrgsApi.md +377 -0
  54. data/docs/P2PackageUpload.md +1 -2
  55. data/docs/P2PackageUploadRequest.md +0 -2
  56. data/docs/Package.md +1 -0
  57. data/docs/PackageCopy.md +1 -2
  58. data/docs/PackageCopyRequest.md +0 -2
  59. data/docs/PackageDetail.md +1 -0
  60. data/docs/PackageLicense.md +0 -2
  61. data/docs/PackageLicenseRequestPatch.md +0 -2
  62. data/docs/PackageMove.md +1 -2
  63. data/docs/PackageMoveRequest.md +0 -2
  64. data/docs/PackageQuarantine.md +1 -2
  65. data/docs/PackageQuarantineRequest.md +0 -2
  66. data/docs/PackageResync.md +1 -2
  67. data/docs/PackageTag.md +1 -2
  68. data/docs/PackageTagRequest.md +0 -2
  69. data/docs/PackageVulnerability.md +0 -2
  70. data/docs/PackagesApi.md +2 -2
  71. data/docs/PythonPackageUpload.md +1 -2
  72. data/docs/PythonPackageUploadRequest.md +0 -2
  73. data/docs/RawPackageUpload.md +1 -2
  74. data/docs/RawPackageUploadRequest.md +0 -2
  75. data/docs/RpmPackageUpload.md +1 -2
  76. data/docs/RpmPackageUploadRequest.md +0 -2
  77. data/docs/RubyPackageUpload.md +1 -2
  78. data/docs/RubyPackageUploadRequest.md +0 -2
  79. data/docs/SwiftPackageUpload.md +1 -2
  80. data/docs/SwiftPackageUploadRequest.md +0 -2
  81. data/docs/TerraformPackageUpload.md +1 -2
  82. data/docs/TerraformPackageUploadRequest.md +0 -2
  83. data/docs/VagrantPackageUpload.md +1 -2
  84. data/docs/VagrantPackageUploadRequest.md +0 -2
  85. data/docs/VsxPackageUpload.md +1 -2
  86. data/docs/VsxPackageUploadRequest.md +0 -2
  87. data/lib/cloudsmith-api/api/orgs_api.rb +353 -0
  88. data/lib/cloudsmith-api/api/packages_api.rb +2 -2
  89. data/lib/cloudsmith-api/models/alpine_package_upload.rb +11 -20
  90. data/lib/cloudsmith-api/models/alpine_package_upload_request.rb +4 -23
  91. data/lib/cloudsmith-api/models/cargo_package_upload.rb +11 -20
  92. data/lib/cloudsmith-api/models/cargo_package_upload_request.rb +4 -23
  93. data/lib/cloudsmith-api/models/cocoapods_package_upload.rb +11 -20
  94. data/lib/cloudsmith-api/models/cocoapods_package_upload_request.rb +4 -23
  95. data/lib/cloudsmith-api/models/composer_package_upload.rb +11 -20
  96. data/lib/cloudsmith-api/models/composer_package_upload_request.rb +4 -23
  97. data/lib/cloudsmith-api/models/conan_package_upload.rb +11 -20
  98. data/lib/cloudsmith-api/models/conan_package_upload_request.rb +4 -23
  99. data/lib/cloudsmith-api/models/conda_package_upload.rb +11 -20
  100. data/lib/cloudsmith-api/models/conda_package_upload_request.rb +4 -23
  101. data/lib/cloudsmith-api/models/connected_repository.rb +35 -4
  102. data/lib/cloudsmith-api/models/connected_repository_target_summary.rb +211 -0
  103. data/lib/cloudsmith-api/models/connected_repository_upstream.rb +194 -0
  104. data/lib/cloudsmith-api/models/cran_package_upload.rb +11 -20
  105. data/lib/cloudsmith-api/models/cran_package_upload_request.rb +4 -23
  106. data/lib/cloudsmith-api/models/dart_package_upload.rb +11 -20
  107. data/lib/cloudsmith-api/models/dart_package_upload_request.rb +4 -23
  108. data/lib/cloudsmith-api/models/deb_package_upload.rb +11 -20
  109. data/lib/cloudsmith-api/models/deb_package_upload_request.rb +4 -23
  110. data/lib/cloudsmith-api/models/docker_package_upload.rb +11 -20
  111. data/lib/cloudsmith-api/models/docker_package_upload_request.rb +4 -23
  112. data/lib/cloudsmith-api/models/generic_package_upload.rb +11 -20
  113. data/lib/cloudsmith-api/models/generic_package_upload_request.rb +4 -23
  114. data/lib/cloudsmith-api/models/go_package_upload.rb +11 -20
  115. data/lib/cloudsmith-api/models/go_package_upload_request.rb +4 -23
  116. data/lib/cloudsmith-api/models/helm_package_upload.rb +11 -20
  117. data/lib/cloudsmith-api/models/helm_package_upload_request.rb +4 -23
  118. data/lib/cloudsmith-api/models/hex_package_upload.rb +11 -20
  119. data/lib/cloudsmith-api/models/hex_package_upload_request.rb +4 -23
  120. data/lib/cloudsmith-api/models/huggingface_package_upload.rb +11 -20
  121. data/lib/cloudsmith-api/models/huggingface_package_upload_request.rb +4 -23
  122. data/lib/cloudsmith-api/models/luarocks_package_upload.rb +11 -20
  123. data/lib/cloudsmith-api/models/luarocks_package_upload_request.rb +4 -23
  124. data/lib/cloudsmith-api/models/maven_package_upload.rb +11 -20
  125. data/lib/cloudsmith-api/models/maven_package_upload_request.rb +4 -23
  126. data/lib/cloudsmith-api/models/mcp_package_upload.rb +11 -20
  127. data/lib/cloudsmith-api/models/mcp_package_upload_request.rb +4 -23
  128. data/lib/cloudsmith-api/models/nix_package_upload.rb +11 -20
  129. data/lib/cloudsmith-api/models/nix_package_upload_request.rb +4 -23
  130. data/lib/cloudsmith-api/models/npm_package_upload.rb +11 -20
  131. data/lib/cloudsmith-api/models/npm_package_upload_request.rb +4 -23
  132. data/lib/cloudsmith-api/models/nuget_package_upload.rb +11 -20
  133. data/lib/cloudsmith-api/models/nuget_package_upload_request.rb +4 -23
  134. data/lib/cloudsmith-api/models/organization_api_key_rule.rb +302 -0
  135. data/lib/cloudsmith-api/models/organization_api_key_rule_request.rb +264 -0
  136. data/lib/cloudsmith-api/models/organization_api_key_rule_request_patch.rb +259 -0
  137. data/lib/cloudsmith-api/models/p2_package_upload.rb +11 -20
  138. data/lib/cloudsmith-api/models/p2_package_upload_request.rb +4 -23
  139. data/lib/cloudsmith-api/models/package.rb +11 -1
  140. data/lib/cloudsmith-api/models/package_copy.rb +11 -20
  141. data/lib/cloudsmith-api/models/package_copy_request.rb +4 -23
  142. data/lib/cloudsmith-api/models/package_detail.rb +11 -1
  143. data/lib/cloudsmith-api/models/package_license.rb +4 -23
  144. data/lib/cloudsmith-api/models/package_license_request_patch.rb +4 -23
  145. data/lib/cloudsmith-api/models/package_move.rb +11 -20
  146. data/lib/cloudsmith-api/models/package_move_request.rb +4 -23
  147. data/lib/cloudsmith-api/models/package_quarantine.rb +11 -20
  148. data/lib/cloudsmith-api/models/package_quarantine_request.rb +4 -23
  149. data/lib/cloudsmith-api/models/package_resync.rb +11 -20
  150. data/lib/cloudsmith-api/models/package_tag.rb +11 -20
  151. data/lib/cloudsmith-api/models/package_tag_request.rb +4 -23
  152. data/lib/cloudsmith-api/models/package_vulnerability.rb +4 -23
  153. data/lib/cloudsmith-api/models/python_package_upload.rb +11 -20
  154. data/lib/cloudsmith-api/models/python_package_upload_request.rb +4 -23
  155. data/lib/cloudsmith-api/models/raw_package_upload.rb +11 -20
  156. data/lib/cloudsmith-api/models/raw_package_upload_request.rb +4 -23
  157. data/lib/cloudsmith-api/models/rpm_package_upload.rb +11 -20
  158. data/lib/cloudsmith-api/models/rpm_package_upload_request.rb +4 -23
  159. data/lib/cloudsmith-api/models/ruby_package_upload.rb +11 -20
  160. data/lib/cloudsmith-api/models/ruby_package_upload_request.rb +4 -23
  161. data/lib/cloudsmith-api/models/swift_package_upload.rb +11 -20
  162. data/lib/cloudsmith-api/models/swift_package_upload_request.rb +4 -23
  163. data/lib/cloudsmith-api/models/terraform_package_upload.rb +11 -20
  164. data/lib/cloudsmith-api/models/terraform_package_upload_request.rb +4 -23
  165. data/lib/cloudsmith-api/models/vagrant_package_upload.rb +11 -20
  166. data/lib/cloudsmith-api/models/vagrant_package_upload_request.rb +4 -23
  167. data/lib/cloudsmith-api/models/vsx_package_upload.rb +11 -20
  168. data/lib/cloudsmith-api/models/vsx_package_upload_request.rb +4 -23
  169. data/lib/cloudsmith-api/version.rb +1 -1
  170. data/lib/cloudsmith-api.rb +5 -0
  171. data/spec/api/orgs_api_spec.rb +79 -0
  172. data/spec/api/packages_api_spec.rb +1 -1
  173. data/spec/models/alpine_package_upload_request_spec.rb +0 -12
  174. data/spec/models/alpine_package_upload_spec.rb +6 -12
  175. data/spec/models/cargo_package_upload_request_spec.rb +0 -12
  176. data/spec/models/cargo_package_upload_spec.rb +6 -12
  177. data/spec/models/cocoapods_package_upload_request_spec.rb +0 -12
  178. data/spec/models/cocoapods_package_upload_spec.rb +6 -12
  179. data/spec/models/composer_package_upload_request_spec.rb +0 -12
  180. data/spec/models/composer_package_upload_spec.rb +6 -12
  181. data/spec/models/conan_package_upload_request_spec.rb +0 -12
  182. data/spec/models/conan_package_upload_spec.rb +6 -12
  183. data/spec/models/conda_package_upload_request_spec.rb +0 -12
  184. data/spec/models/conda_package_upload_spec.rb +6 -12
  185. data/spec/models/connected_repository_spec.rb +18 -0
  186. data/spec/models/connected_repository_target_summary_spec.rb +59 -0
  187. data/spec/models/connected_repository_upstream_spec.rb +47 -0
  188. data/spec/models/cran_package_upload_request_spec.rb +0 -12
  189. data/spec/models/cran_package_upload_spec.rb +6 -12
  190. data/spec/models/dart_package_upload_request_spec.rb +0 -12
  191. data/spec/models/dart_package_upload_spec.rb +6 -12
  192. data/spec/models/deb_package_upload_request_spec.rb +0 -12
  193. data/spec/models/deb_package_upload_spec.rb +6 -12
  194. data/spec/models/docker_package_upload_request_spec.rb +0 -12
  195. data/spec/models/docker_package_upload_spec.rb +6 -12
  196. data/spec/models/generic_package_upload_request_spec.rb +0 -12
  197. data/spec/models/generic_package_upload_spec.rb +6 -12
  198. data/spec/models/go_package_upload_request_spec.rb +0 -12
  199. data/spec/models/go_package_upload_spec.rb +6 -12
  200. data/spec/models/helm_package_upload_request_spec.rb +0 -12
  201. data/spec/models/helm_package_upload_spec.rb +6 -12
  202. data/spec/models/hex_package_upload_request_spec.rb +0 -12
  203. data/spec/models/hex_package_upload_spec.rb +6 -12
  204. data/spec/models/huggingface_package_upload_request_spec.rb +0 -12
  205. data/spec/models/huggingface_package_upload_spec.rb +6 -12
  206. data/spec/models/luarocks_package_upload_request_spec.rb +0 -12
  207. data/spec/models/luarocks_package_upload_spec.rb +6 -12
  208. data/spec/models/maven_package_upload_request_spec.rb +0 -12
  209. data/spec/models/maven_package_upload_spec.rb +6 -12
  210. data/spec/models/mcp_package_upload_request_spec.rb +0 -12
  211. data/spec/models/mcp_package_upload_spec.rb +6 -12
  212. data/spec/models/nix_package_upload_request_spec.rb +0 -12
  213. data/spec/models/nix_package_upload_spec.rb +6 -12
  214. data/spec/models/npm_package_upload_request_spec.rb +0 -12
  215. data/spec/models/npm_package_upload_spec.rb +6 -12
  216. data/spec/models/nuget_package_upload_request_spec.rb +0 -12
  217. data/spec/models/nuget_package_upload_spec.rb +6 -12
  218. data/spec/models/organization_api_key_rule_request_patch_spec.rb +69 -0
  219. data/spec/models/organization_api_key_rule_request_spec.rb +69 -0
  220. data/spec/models/organization_api_key_rule_spec.rb +93 -0
  221. data/spec/models/p2_package_upload_request_spec.rb +0 -12
  222. data/spec/models/p2_package_upload_spec.rb +6 -12
  223. data/spec/models/package_copy_request_spec.rb +0 -12
  224. data/spec/models/package_copy_spec.rb +6 -12
  225. data/spec/models/package_detail_spec.rb +6 -0
  226. data/spec/models/package_license_request_patch_spec.rb +0 -12
  227. data/spec/models/package_license_spec.rb +0 -12
  228. data/spec/models/package_move_request_spec.rb +0 -12
  229. data/spec/models/package_move_spec.rb +6 -12
  230. data/spec/models/package_quarantine_request_spec.rb +0 -12
  231. data/spec/models/package_quarantine_spec.rb +6 -12
  232. data/spec/models/package_resync_spec.rb +6 -12
  233. data/spec/models/package_spec.rb +6 -0
  234. data/spec/models/package_tag_request_spec.rb +0 -12
  235. data/spec/models/package_tag_spec.rb +6 -12
  236. data/spec/models/package_vulnerability_spec.rb +0 -12
  237. data/spec/models/python_package_upload_request_spec.rb +0 -12
  238. data/spec/models/python_package_upload_spec.rb +6 -12
  239. data/spec/models/raw_package_upload_request_spec.rb +0 -12
  240. data/spec/models/raw_package_upload_spec.rb +6 -12
  241. data/spec/models/rpm_package_upload_request_spec.rb +0 -12
  242. data/spec/models/rpm_package_upload_spec.rb +6 -12
  243. data/spec/models/ruby_package_upload_request_spec.rb +0 -12
  244. data/spec/models/ruby_package_upload_spec.rb +6 -12
  245. data/spec/models/swift_package_upload_request_spec.rb +0 -12
  246. data/spec/models/swift_package_upload_spec.rb +6 -12
  247. data/spec/models/terraform_package_upload_request_spec.rb +0 -12
  248. data/spec/models/terraform_package_upload_spec.rb +6 -12
  249. data/spec/models/vagrant_package_upload_request_spec.rb +0 -12
  250. data/spec/models/vagrant_package_upload_spec.rb +6 -12
  251. data/spec/models/vsx_package_upload_request_spec.rb +0 -12
  252. data/spec/models/vsx_package_upload_spec.rb +6 -12
  253. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/autotest-fsevent-0.3.2/gem_make.out +1 -1
  254. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/bigdecimal-4.1.2/gem_make.out +2 -2
  255. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/bigdecimal-4.1.2/mkmf.log +4 -4
  256. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/ffi-1.17.4/gem_make.out +2 -2
  257. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/ffi-1.17.4/mkmf.log +1 -1
  258. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/json-2.7.6/gem_make.out +2 -2
  259. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/json-2.7.6/mkmf.log +1 -1
  260. data/vendor/bundle/ruby/2.6.0/gems/bigdecimal-4.1.2/ext/bigdecimal/Makefile +2 -2
  261. data/vendor/bundle/ruby/2.6.0/gems/ffi-1.17.4/ext/ffi_c/Makefile +2 -2
  262. data/vendor/bundle/ruby/2.6.0/gems/json-2.7.6/ext/json/ext/generator/Makefile +2 -2
  263. data/vendor/bundle/ruby/2.6.0/gems/json-2.7.6/ext/json/ext/parser/Makefile +2 -2
  264. metadata +26 -6
@@ -0,0 +1,302 @@
1
+ =begin
2
+ #Cloudsmith API (v1)
3
+
4
+ #The API to the Cloudsmith Service
5
+
6
+ OpenAPI spec version: v1
7
+ Contact: support@cloudsmith.io
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.50
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudsmithApi
16
+ class OrganizationApiKeyRule
17
+ attr_accessor :created_at
18
+
19
+ # When enabled, API keys that violate the organization's rule will be replaced automatically.
20
+ attr_accessor :enforce_refresh
21
+
22
+ # Whether this rule is currently active and enforced.
23
+ attr_accessor :is_enabled
24
+
25
+ # The last time this rule was evaluated and applied by the expiry task.
26
+ attr_accessor :last_applied_at
27
+
28
+ # The maximum permitted age of an API key for use in the organization. API keys older than this will no longer have access until they are refreshed. To disable the rule unset this value.
29
+ attr_accessor :max_age_hours
30
+
31
+ # Specify which account types this rule applies to: all accounts (deprecated — prefer separate service/user rules), service accounts only, or user accounts only.
32
+ attr_accessor :rule_type
33
+
34
+ # Human-readable identifier for the rule type. Automatically generated based on the rule type.
35
+ attr_accessor :slug
36
+
37
+ # An auto-generated id that uniquely identifies the API key policy.
38
+ attr_accessor :slug_perm
39
+
40
+ attr_accessor :updated_at
41
+
42
+ class EnumAttributeValidator
43
+ attr_reader :datatype
44
+ attr_reader :allowable_values
45
+
46
+ def initialize(datatype, allowable_values)
47
+ @allowable_values = allowable_values.map do |value|
48
+ case datatype.to_s
49
+ when /Integer/i
50
+ value.to_i
51
+ when /Float/i
52
+ value.to_f
53
+ else
54
+ value
55
+ end
56
+ end
57
+ end
58
+
59
+ def valid?(value)
60
+ !value || allowable_values.include?(value)
61
+ end
62
+ end
63
+
64
+ # Attribute mapping from ruby-style variable name to JSON key.
65
+ def self.attribute_map
66
+ {
67
+ :'created_at' => :'created_at',
68
+ :'enforce_refresh' => :'enforce_refresh',
69
+ :'is_enabled' => :'is_enabled',
70
+ :'last_applied_at' => :'last_applied_at',
71
+ :'max_age_hours' => :'max_age_hours',
72
+ :'rule_type' => :'rule_type',
73
+ :'slug' => :'slug',
74
+ :'slug_perm' => :'slug_perm',
75
+ :'updated_at' => :'updated_at'
76
+ }
77
+ end
78
+
79
+ # Attribute type mapping.
80
+ def self.swagger_types
81
+ {
82
+ :'created_at' => :'DateTime',
83
+ :'enforce_refresh' => :'BOOLEAN',
84
+ :'is_enabled' => :'BOOLEAN',
85
+ :'last_applied_at' => :'DateTime',
86
+ :'max_age_hours' => :'Integer',
87
+ :'rule_type' => :'String',
88
+ :'slug' => :'String',
89
+ :'slug_perm' => :'String',
90
+ :'updated_at' => :'DateTime'
91
+ }
92
+ end
93
+
94
+ # Initializes the object
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ def initialize(attributes = {})
97
+ return unless attributes.is_a?(Hash)
98
+
99
+ # convert string to symbol for hash key
100
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
101
+
102
+ if attributes.has_key?(:'created_at')
103
+ self.created_at = attributes[:'created_at']
104
+ end
105
+
106
+ if attributes.has_key?(:'enforce_refresh')
107
+ self.enforce_refresh = attributes[:'enforce_refresh']
108
+ end
109
+
110
+ if attributes.has_key?(:'is_enabled')
111
+ self.is_enabled = attributes[:'is_enabled']
112
+ end
113
+
114
+ if attributes.has_key?(:'last_applied_at')
115
+ self.last_applied_at = attributes[:'last_applied_at']
116
+ end
117
+
118
+ if attributes.has_key?(:'max_age_hours')
119
+ self.max_age_hours = attributes[:'max_age_hours']
120
+ end
121
+
122
+ if attributes.has_key?(:'rule_type')
123
+ self.rule_type = attributes[:'rule_type']
124
+ end
125
+
126
+ if attributes.has_key?(:'slug')
127
+ self.slug = attributes[:'slug']
128
+ end
129
+
130
+ if attributes.has_key?(:'slug_perm')
131
+ self.slug_perm = attributes[:'slug_perm']
132
+ end
133
+
134
+ if attributes.has_key?(:'updated_at')
135
+ self.updated_at = attributes[:'updated_at']
136
+ end
137
+ end
138
+
139
+ # Show invalid properties with the reasons. Usually used together with valid?
140
+ # @return Array for valid properties with the reasons
141
+ def list_invalid_properties
142
+ invalid_properties = Array.new
143
+ if @rule_type.nil?
144
+ invalid_properties.push('invalid value for "rule_type", rule_type cannot be nil.')
145
+ end
146
+
147
+ invalid_properties
148
+ end
149
+
150
+ # Check to see if the all the properties in the model are valid
151
+ # @return true if the model is valid
152
+ def valid?
153
+ return false if @rule_type.nil?
154
+ rule_type_validator = EnumAttributeValidator.new('String', ['All Accounts', 'Service Accounts', 'User Accounts'])
155
+ return false unless rule_type_validator.valid?(@rule_type)
156
+ true
157
+ end
158
+
159
+ # Custom attribute writer method checking allowed values (enum).
160
+ # @param [Object] rule_type Object to be assigned
161
+ def rule_type=(rule_type)
162
+ validator = EnumAttributeValidator.new('String', ['All Accounts', 'Service Accounts', 'User Accounts'])
163
+ unless validator.valid?(rule_type)
164
+ fail ArgumentError, 'invalid value for "rule_type", must be one of #{validator.allowable_values}.'
165
+ end
166
+ @rule_type = rule_type
167
+ end
168
+
169
+ # Checks equality by comparing each attribute.
170
+ # @param [Object] Object to be compared
171
+ def ==(o)
172
+ return true if self.equal?(o)
173
+ self.class == o.class &&
174
+ created_at == o.created_at &&
175
+ enforce_refresh == o.enforce_refresh &&
176
+ is_enabled == o.is_enabled &&
177
+ last_applied_at == o.last_applied_at &&
178
+ max_age_hours == o.max_age_hours &&
179
+ rule_type == o.rule_type &&
180
+ slug == o.slug &&
181
+ slug_perm == o.slug_perm &&
182
+ updated_at == o.updated_at
183
+ end
184
+
185
+ # @see the `==` method
186
+ # @param [Object] Object to be compared
187
+ def eql?(o)
188
+ self == o
189
+ end
190
+
191
+ # Calculates hash code according to all attributes.
192
+ # @return [Fixnum] Hash code
193
+ def hash
194
+ [created_at, enforce_refresh, is_enabled, last_applied_at, max_age_hours, rule_type, slug, slug_perm, updated_at].hash
195
+ end
196
+
197
+ # Builds the object from hash
198
+ # @param [Hash] attributes Model attributes in the form of hash
199
+ # @return [Object] Returns the model itself
200
+ def build_from_hash(attributes)
201
+ return nil unless attributes.is_a?(Hash)
202
+ self.class.swagger_types.each_pair do |key, type|
203
+ if type =~ /\AArray<(.*)>/i
204
+ # check to ensure the input is an array given that the attribute
205
+ # is documented as an array but the input is not
206
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
207
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
208
+ end
209
+ elsif !attributes[self.class.attribute_map[key]].nil?
210
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
211
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
212
+ end
213
+
214
+ self
215
+ end
216
+
217
+ # Deserializes the data based on type
218
+ # @param string type Data type
219
+ # @param string value Value to be deserialized
220
+ # @return [Object] Deserialized data
221
+ def _deserialize(type, value)
222
+ case type.to_sym
223
+ when :DateTime
224
+ DateTime.parse(value)
225
+ when :Date
226
+ Date.parse(value)
227
+ when :String
228
+ value.to_s
229
+ when :Integer
230
+ value.to_i
231
+ when :Float
232
+ value.to_f
233
+ when :BOOLEAN
234
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
235
+ true
236
+ else
237
+ false
238
+ end
239
+ when :Object
240
+ # generic object (usually a Hash), return directly
241
+ value
242
+ when /\AArray<(?<inner_type>.+)>\z/
243
+ inner_type = Regexp.last_match[:inner_type]
244
+ value.map { |v| _deserialize(inner_type, v) }
245
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
246
+ k_type = Regexp.last_match[:k_type]
247
+ v_type = Regexp.last_match[:v_type]
248
+ {}.tap do |hash|
249
+ value.each do |k, v|
250
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
251
+ end
252
+ end
253
+ else # model
254
+ temp_model = CloudsmithApi.const_get(type).new
255
+ temp_model.build_from_hash(value)
256
+ end
257
+ end
258
+
259
+ # Returns the string representation of the object
260
+ # @return [String] String presentation of the object
261
+ def to_s
262
+ to_hash.to_s
263
+ end
264
+
265
+ # to_body is an alias to to_hash (backward compatibility)
266
+ # @return [Hash] Returns the object in the form of hash
267
+ def to_body
268
+ to_hash
269
+ end
270
+
271
+ # Returns the object in the form of hash
272
+ # @return [Hash] Returns the object in the form of hash
273
+ def to_hash
274
+ hash = {}
275
+ self.class.attribute_map.each_pair do |attr, param|
276
+ value = self.send(attr)
277
+ next if value.nil?
278
+ hash[param] = _to_hash(value)
279
+ end
280
+ hash
281
+ end
282
+
283
+ # Outputs non-array value in the form of hash
284
+ # For object, use to_hash. Otherwise, just return the value
285
+ # @param [Object] value Any valid value
286
+ # @return [Hash] Returns the value in the form of hash
287
+ def _to_hash(value)
288
+ if value.is_a?(Array)
289
+ value.compact.map { |v| _to_hash(v) }
290
+ elsif value.is_a?(Hash)
291
+ {}.tap do |hash|
292
+ value.each { |k, v| hash[k] = _to_hash(v) }
293
+ end
294
+ elsif value.respond_to? :to_hash
295
+ value.to_hash
296
+ else
297
+ value
298
+ end
299
+ end
300
+
301
+ end
302
+ end
@@ -0,0 +1,264 @@
1
+ =begin
2
+ #Cloudsmith API (v1)
3
+
4
+ #The API to the Cloudsmith Service
5
+
6
+ OpenAPI spec version: v1
7
+ Contact: support@cloudsmith.io
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.50
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudsmithApi
16
+ class OrganizationApiKeyRuleRequest
17
+ # When enabled, API keys that violate the organization's rule will be replaced automatically.
18
+ attr_accessor :enforce_refresh
19
+
20
+ # Whether this rule is currently active and enforced.
21
+ attr_accessor :is_enabled
22
+
23
+ # The maximum permitted age of an API key for use in the organization. API keys older than this will no longer have access until they are refreshed. To disable the rule unset this value.
24
+ attr_accessor :max_age_hours
25
+
26
+ # If set to True, API keys that violate this rule will be replaced immediately after the request is made. There is no way to undo this.
27
+ attr_accessor :refresh_immediately
28
+
29
+ # Specify which account types this rule applies to: all accounts (deprecated — prefer separate service/user rules), service accounts only, or user accounts only.
30
+ attr_accessor :rule_type
31
+
32
+ class EnumAttributeValidator
33
+ attr_reader :datatype
34
+ attr_reader :allowable_values
35
+
36
+ def initialize(datatype, allowable_values)
37
+ @allowable_values = allowable_values.map do |value|
38
+ case datatype.to_s
39
+ when /Integer/i
40
+ value.to_i
41
+ when /Float/i
42
+ value.to_f
43
+ else
44
+ value
45
+ end
46
+ end
47
+ end
48
+
49
+ def valid?(value)
50
+ !value || allowable_values.include?(value)
51
+ end
52
+ end
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'enforce_refresh' => :'enforce_refresh',
58
+ :'is_enabled' => :'is_enabled',
59
+ :'max_age_hours' => :'max_age_hours',
60
+ :'refresh_immediately' => :'refresh_immediately',
61
+ :'rule_type' => :'rule_type'
62
+ }
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.swagger_types
67
+ {
68
+ :'enforce_refresh' => :'BOOLEAN',
69
+ :'is_enabled' => :'BOOLEAN',
70
+ :'max_age_hours' => :'Integer',
71
+ :'refresh_immediately' => :'BOOLEAN',
72
+ :'rule_type' => :'String'
73
+ }
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ return unless attributes.is_a?(Hash)
80
+
81
+ # convert string to symbol for hash key
82
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
83
+
84
+ if attributes.has_key?(:'enforce_refresh')
85
+ self.enforce_refresh = attributes[:'enforce_refresh']
86
+ end
87
+
88
+ if attributes.has_key?(:'is_enabled')
89
+ self.is_enabled = attributes[:'is_enabled']
90
+ end
91
+
92
+ if attributes.has_key?(:'max_age_hours')
93
+ self.max_age_hours = attributes[:'max_age_hours']
94
+ end
95
+
96
+ if attributes.has_key?(:'refresh_immediately')
97
+ self.refresh_immediately = attributes[:'refresh_immediately']
98
+ end
99
+
100
+ if attributes.has_key?(:'rule_type')
101
+ self.rule_type = attributes[:'rule_type']
102
+ end
103
+ end
104
+
105
+ # Show invalid properties with the reasons. Usually used together with valid?
106
+ # @return Array for valid properties with the reasons
107
+ def list_invalid_properties
108
+ invalid_properties = Array.new
109
+ if @rule_type.nil?
110
+ invalid_properties.push('invalid value for "rule_type", rule_type cannot be nil.')
111
+ end
112
+
113
+ invalid_properties
114
+ end
115
+
116
+ # Check to see if the all the properties in the model are valid
117
+ # @return true if the model is valid
118
+ def valid?
119
+ return false if @rule_type.nil?
120
+ rule_type_validator = EnumAttributeValidator.new('String', ['All Accounts', 'Service Accounts', 'User Accounts'])
121
+ return false unless rule_type_validator.valid?(@rule_type)
122
+ true
123
+ end
124
+
125
+ # Custom attribute writer method checking allowed values (enum).
126
+ # @param [Object] rule_type Object to be assigned
127
+ def rule_type=(rule_type)
128
+ validator = EnumAttributeValidator.new('String', ['All Accounts', 'Service Accounts', 'User Accounts'])
129
+ unless validator.valid?(rule_type)
130
+ fail ArgumentError, 'invalid value for "rule_type", must be one of #{validator.allowable_values}.'
131
+ end
132
+ @rule_type = rule_type
133
+ end
134
+
135
+ # Checks equality by comparing each attribute.
136
+ # @param [Object] Object to be compared
137
+ def ==(o)
138
+ return true if self.equal?(o)
139
+ self.class == o.class &&
140
+ enforce_refresh == o.enforce_refresh &&
141
+ is_enabled == o.is_enabled &&
142
+ max_age_hours == o.max_age_hours &&
143
+ refresh_immediately == o.refresh_immediately &&
144
+ rule_type == o.rule_type
145
+ end
146
+
147
+ # @see the `==` method
148
+ # @param [Object] Object to be compared
149
+ def eql?(o)
150
+ self == o
151
+ end
152
+
153
+ # Calculates hash code according to all attributes.
154
+ # @return [Fixnum] Hash code
155
+ def hash
156
+ [enforce_refresh, is_enabled, max_age_hours, refresh_immediately, rule_type].hash
157
+ end
158
+
159
+ # Builds the object from hash
160
+ # @param [Hash] attributes Model attributes in the form of hash
161
+ # @return [Object] Returns the model itself
162
+ def build_from_hash(attributes)
163
+ return nil unless attributes.is_a?(Hash)
164
+ self.class.swagger_types.each_pair do |key, type|
165
+ if type =~ /\AArray<(.*)>/i
166
+ # check to ensure the input is an array given that the attribute
167
+ # is documented as an array but the input is not
168
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
169
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
170
+ end
171
+ elsif !attributes[self.class.attribute_map[key]].nil?
172
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
173
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
174
+ end
175
+
176
+ self
177
+ end
178
+
179
+ # Deserializes the data based on type
180
+ # @param string type Data type
181
+ # @param string value Value to be deserialized
182
+ # @return [Object] Deserialized data
183
+ def _deserialize(type, value)
184
+ case type.to_sym
185
+ when :DateTime
186
+ DateTime.parse(value)
187
+ when :Date
188
+ Date.parse(value)
189
+ when :String
190
+ value.to_s
191
+ when :Integer
192
+ value.to_i
193
+ when :Float
194
+ value.to_f
195
+ when :BOOLEAN
196
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
197
+ true
198
+ else
199
+ false
200
+ end
201
+ when :Object
202
+ # generic object (usually a Hash), return directly
203
+ value
204
+ when /\AArray<(?<inner_type>.+)>\z/
205
+ inner_type = Regexp.last_match[:inner_type]
206
+ value.map { |v| _deserialize(inner_type, v) }
207
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
208
+ k_type = Regexp.last_match[:k_type]
209
+ v_type = Regexp.last_match[:v_type]
210
+ {}.tap do |hash|
211
+ value.each do |k, v|
212
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
213
+ end
214
+ end
215
+ else # model
216
+ temp_model = CloudsmithApi.const_get(type).new
217
+ temp_model.build_from_hash(value)
218
+ end
219
+ end
220
+
221
+ # Returns the string representation of the object
222
+ # @return [String] String presentation of the object
223
+ def to_s
224
+ to_hash.to_s
225
+ end
226
+
227
+ # to_body is an alias to to_hash (backward compatibility)
228
+ # @return [Hash] Returns the object in the form of hash
229
+ def to_body
230
+ to_hash
231
+ end
232
+
233
+ # Returns the object in the form of hash
234
+ # @return [Hash] Returns the object in the form of hash
235
+ def to_hash
236
+ hash = {}
237
+ self.class.attribute_map.each_pair do |attr, param|
238
+ value = self.send(attr)
239
+ next if value.nil?
240
+ hash[param] = _to_hash(value)
241
+ end
242
+ hash
243
+ end
244
+
245
+ # Outputs non-array value in the form of hash
246
+ # For object, use to_hash. Otherwise, just return the value
247
+ # @param [Object] value Any valid value
248
+ # @return [Hash] Returns the value in the form of hash
249
+ def _to_hash(value)
250
+ if value.is_a?(Array)
251
+ value.compact.map { |v| _to_hash(v) }
252
+ elsif value.is_a?(Hash)
253
+ {}.tap do |hash|
254
+ value.each { |k, v| hash[k] = _to_hash(v) }
255
+ end
256
+ elsif value.respond_to? :to_hash
257
+ value.to_hash
258
+ else
259
+ value
260
+ end
261
+ end
262
+
263
+ end
264
+ end