Class: Files::Secret
- Inherits:
-
Object
- Object
- Files::Secret
- Defined in:
- lib/files.com/models/secret.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
- .all(params = {}, options = {}) ⇒ Object
-
.create(params = {}, options = {}) ⇒ Object
Parameters: name (required) - string - Secret name.
- .delete(id, params = {}, options = {}) ⇒ Object
- .destroy(id, params = {}, options = {}) ⇒ Object
-
.find(id, params = {}, options = {}) ⇒ Object
Parameters: id (required) - int64 - Secret ID.
- .get(id, params = {}, options = {}) ⇒ Object
-
.list(params = {}, options = {}) ⇒ Object
Parameters: cursor - string - Used for pagination.
-
.update(id, params = {}, options = {}) ⇒ Object
Parameters: name - string - Secret name.
Instance Method Summary collapse
-
#created_at ⇒ Object
date-time - Secret create date/time.
- #delete(params = {}) ⇒ Object
-
#description ⇒ Object
string - Internal description for your reference.
- #description=(value) ⇒ Object
- #destroy(params = {}) ⇒ Object
-
#id ⇒ Object
int64 - Secret ID.
- #id=(value) ⇒ Object
-
#initialize(attributes = {}, options = {}) ⇒ Secret
constructor
A new instance of Secret.
-
#metadata ⇒ Object
object - Non-secret metadata for the Secret type.
- #metadata=(value) ⇒ Object
-
#name ⇒ Object
string - Secret name.
- #name=(value) ⇒ Object
- #save ⇒ Object
-
#secret_type ⇒ Object
string - Secret type.
- #secret_type=(value) ⇒ Object
-
#update(params = {}) ⇒ Object
Parameters: name - string - Secret name.
-
#updated_at ⇒ Object
date-time - Secret update date/time.
-
#value_field_names ⇒ Object
array(string) - Names of configured secret value fields.
- #value_field_names=(value) ⇒ Object
-
#workspace_id ⇒ Object
int64 - Workspace ID.
- #workspace_id=(value) ⇒ Object
Constructor Details
#initialize(attributes = {}, options = {}) ⇒ Secret
Returns a new instance of Secret.
7 8 9 10 |
# File 'lib/files.com/models/secret.rb', line 7 def initialize(attributes = {}, = {}) @attributes = attributes || {} @options = || {} end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/files.com/models/secret.rb', line 5 def attributes @attributes end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/files.com/models/secret.rb', line 5 def @options end |
Class Method Details
.all(params = {}, options = {}) ⇒ Object
147 148 149 |
# File 'lib/files.com/models/secret.rb', line 147 def self.all(params = {}, = {}) list(params, ) end |
.create(params = {}, options = {}) ⇒ Object
Parameters:
name (required) - string - Secret name.
description - string - Internal description for your reference.
secret_type (required) - string - Secret type.
metadata - object - Non-secret metadata for the Secret type.
workspace_id - int64 - Workspace ID. 0 means the default workspace.
173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/files.com/models/secret.rb', line 173 def self.create(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String) raise InvalidParameterError.new("Bad parameter: description must be an String") if params[:description] and !params[:description].is_a?(String) raise InvalidParameterError.new("Bad parameter: secret_type must be an String") if params[:secret_type] and !params[:secret_type].is_a?(String) raise InvalidParameterError.new("Bad parameter: metadata must be an Hash") if params[:metadata] and !params[:metadata].is_a?(Hash) raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer) raise MissingParameterError.new("Parameter missing: name") unless params[:name] raise MissingParameterError.new("Parameter missing: secret_type") unless params[:secret_type] response, = Api.send_request("/secrets", :post, params, ) Secret.new(response.data, ) end |
.delete(id, params = {}, options = {}) ⇒ Object
205 206 207 208 209 210 211 212 213 |
# File 'lib/files.com/models/secret.rb', line 205 def self.delete(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params[:id] Api.send_request("/secrets/#{params[:id]}", :delete, params, ) nil end |
.destroy(id, params = {}, options = {}) ⇒ Object
215 216 217 218 |
# File 'lib/files.com/models/secret.rb', line 215 def self.destroy(id, params = {}, = {}) delete(id, params, ) nil end |
.find(id, params = {}, options = {}) ⇒ Object
Parameters:
id (required) - int64 - Secret ID.
153 154 155 156 157 158 159 160 161 |
# File 'lib/files.com/models/secret.rb', line 153 def self.find(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params[:id] response, = Api.send_request("/secrets/#{params[:id]}", :get, params, ) Secret.new(response.data, ) end |
.get(id, params = {}, options = {}) ⇒ Object
163 164 165 |
# File 'lib/files.com/models/secret.rb', line 163 def self.get(id, params = {}, = {}) find(id, params, ) end |
.list(params = {}, options = {}) ⇒ Object
Parameters:
cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
per_page - int64 - Number of records to show per page. (Max: 10000, 1,000 or less is recommended).
sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `workspace_id`, `name` or `secret_type`.
filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `workspace_id`, `name` or `secret_type`. Valid field combinations are `[ workspace_id, name ]`, `[ workspace_id, secret_type ]`, `[ secret_type, name ]` or `[ workspace_id, secret_type, name ]`.
filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `name`.
135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/files.com/models/secret.rb', line 135 def self.list(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String) raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash) raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash) raise InvalidParameterError.new("Bad parameter: filter_prefix must be an Hash") if params[:filter_prefix] and !params[:filter_prefix].is_a?(Hash) List.new(Secret, params) do Api.send_request("/secrets", :get, params, ) end end |
.update(id, params = {}, options = {}) ⇒ Object
Parameters:
name - string - Secret name.
description - string - Internal description for your reference.
secret_type - string - Secret type.
metadata - object - Non-secret metadata for the Secret type.
191 192 193 194 195 196 197 198 199 200 201 202 203 |
# File 'lib/files.com/models/secret.rb', line 191 def self.update(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String) raise InvalidParameterError.new("Bad parameter: description must be an String") if params[:description] and !params[:description].is_a?(String) raise InvalidParameterError.new("Bad parameter: secret_type must be an String") if params[:secret_type] and !params[:secret_type].is_a?(String) raise InvalidParameterError.new("Bad parameter: metadata must be an Hash") if params[:metadata] and !params[:metadata].is_a?(Hash) raise MissingParameterError.new("Parameter missing: id") unless params[:id] response, = Api.send_request("/secrets/#{params[:id]}", :patch, params, ) Secret.new(response.data, ) end |
Instance Method Details
#created_at ⇒ Object
date-time - Secret create date/time.
76 77 78 |
# File 'lib/files.com/models/secret.rb', line 76 def created_at @attributes[:created_at] end |
#delete(params = {}) ⇒ Object
103 104 105 106 107 108 109 110 111 |
# File 'lib/files.com/models/secret.rb', line 103 def delete(params = {}) params ||= {} params[:id] = @attributes[:id] raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id] raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params[:id] Api.send_request("/secrets/#{@attributes[:id]}", :delete, params, @options) end |
#description ⇒ Object
string - Internal description for your reference.
40 41 42 |
# File 'lib/files.com/models/secret.rb', line 40 def description @attributes[:description] end |
#description=(value) ⇒ Object
44 45 46 |
# File 'lib/files.com/models/secret.rb', line 44 def description=(value) @attributes[:description] = value end |
#destroy(params = {}) ⇒ Object
113 114 115 116 |
# File 'lib/files.com/models/secret.rb', line 113 def destroy(params = {}) delete(params) nil end |
#id ⇒ Object
int64 - Secret ID.
13 14 15 |
# File 'lib/files.com/models/secret.rb', line 13 def id @attributes[:id] end |
#id=(value) ⇒ Object
17 18 19 |
# File 'lib/files.com/models/secret.rb', line 17 def id=(value) @attributes[:id] = value end |
#metadata ⇒ Object
object - Non-secret metadata for the Secret type.
58 59 60 |
# File 'lib/files.com/models/secret.rb', line 58 def @attributes[:metadata] end |
#metadata=(value) ⇒ Object
62 63 64 |
# File 'lib/files.com/models/secret.rb', line 62 def (value) @attributes[:metadata] = value end |
#name ⇒ Object
string - Secret name.
31 32 33 |
# File 'lib/files.com/models/secret.rb', line 31 def name @attributes[:name] end |
#name=(value) ⇒ Object
35 36 37 |
# File 'lib/files.com/models/secret.rb', line 35 def name=(value) @attributes[:name] = value end |
#save ⇒ Object
118 119 120 121 122 123 124 125 126 127 |
# File 'lib/files.com/models/secret.rb', line 118 def save if @attributes[:id] new_obj = update(@attributes) else new_obj = Secret.create(@attributes, @options) end @attributes = new_obj.attributes true end |
#secret_type ⇒ Object
string - Secret type.
49 50 51 |
# File 'lib/files.com/models/secret.rb', line 49 def secret_type @attributes[:secret_type] end |
#secret_type=(value) ⇒ Object
53 54 55 |
# File 'lib/files.com/models/secret.rb', line 53 def secret_type=(value) @attributes[:secret_type] = value end |
#update(params = {}) ⇒ Object
Parameters:
name - string - Secret name.
description - string - Internal description for your reference.
secret_type - string - Secret type.
metadata - object - Non-secret metadata for the Secret type.
90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/files.com/models/secret.rb', line 90 def update(params = {}) params ||= {} params[:id] = @attributes[:id] raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id] raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String) raise InvalidParameterError.new("Bad parameter: description must be an String") if params[:description] and !params[:description].is_a?(String) raise InvalidParameterError.new("Bad parameter: secret_type must be an String") if params[:secret_type] and !params[:secret_type].is_a?(String) raise MissingParameterError.new("Parameter missing: id") unless params[:id] Api.send_request("/secrets/#{@attributes[:id]}", :patch, params, @options) end |
#updated_at ⇒ Object
date-time - Secret update date/time.
81 82 83 |
# File 'lib/files.com/models/secret.rb', line 81 def updated_at @attributes[:updated_at] end |
#value_field_names ⇒ Object
array(string) - Names of configured secret value fields. Secret values are never returned.
67 68 69 |
# File 'lib/files.com/models/secret.rb', line 67 def value_field_names @attributes[:value_field_names] end |
#value_field_names=(value) ⇒ Object
71 72 73 |
# File 'lib/files.com/models/secret.rb', line 71 def value_field_names=(value) @attributes[:value_field_names] = value end |
#workspace_id ⇒ Object
int64 - Workspace ID. 0 means the default workspace.
22 23 24 |
# File 'lib/files.com/models/secret.rb', line 22 def workspace_id @attributes[:workspace_id] end |
#workspace_id=(value) ⇒ Object
26 27 28 |
# File 'lib/files.com/models/secret.rb', line 26 def workspace_id=(value) @attributes[:workspace_id] = value end |