Class: Files::RemoteServer
- Inherits:
-
Object
- Object
- Files::RemoteServer
- Defined in:
- lib/files.com/models/remote_server.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: aws_access_key - string - AWS Access Key.
- .delete(id, params = {}, options = {}) ⇒ Object
- .destroy(id, params = {}, options = {}) ⇒ Object
-
.find(id, params = {}, options = {}) ⇒ Object
Parameters: id (required) - integer - Remote Server ID.
- .get(id, params = {}, options = {}) ⇒ Object
-
.list(params = {}, options = {}) ⇒ Object
Parameters: page - integer - Current page number.
-
.update(id, params = {}, options = {}) ⇒ Object
Parameters: aws_access_key - string - AWS Access Key.
Instance Method Summary collapse
-
#aws_access_key ⇒ Object
string - AWS Access Key.
- #aws_access_key=(value) ⇒ Object
-
#aws_secret_key ⇒ Object
string - AWS secret key.
- #aws_secret_key=(value) ⇒ Object
- #delete(params = {}) ⇒ Object
- #destroy(params = {}) ⇒ Object
-
#hostname ⇒ Object
string - Hostname or IP address.
- #hostname=(value) ⇒ Object
-
#id ⇒ Object
int64 - Remote server ID.
- #id=(value) ⇒ Object
-
#initialize(attributes = {}, options = {}) ⇒ RemoteServer
constructor
A new instance of RemoteServer.
-
#name ⇒ Object
string - Internal name for your reference.
- #name=(value) ⇒ Object
-
#password ⇒ Object
string - Password if needed.
- #password=(value) ⇒ Object
-
#port ⇒ Object
int64 - Port for remote server.
- #port=(value) ⇒ Object
-
#private_key ⇒ Object
string - Private key if needed.
- #private_key=(value) ⇒ Object
-
#s3_bucket ⇒ Object
string - S3 bucket name.
- #s3_bucket=(value) ⇒ Object
-
#s3_region ⇒ Object
string - S3 region.
- #s3_region=(value) ⇒ Object
- #save ⇒ Object
-
#server_certificate ⇒ Object
string - Remote server certificate.
- #server_certificate=(value) ⇒ Object
-
#server_type ⇒ Object
string - Remote server type.
- #server_type=(value) ⇒ Object
-
#ssl ⇒ Object
string - Should we require SSL?.
- #ssl=(value) ⇒ Object
-
#update(params = {}) ⇒ Object
Parameters: aws_access_key - string - AWS Access Key.
-
#username ⇒ Object
string - Remote server username.
- #username=(value) ⇒ Object
Constructor Details
#initialize(attributes = {}, options = {}) ⇒ RemoteServer
Returns a new instance of RemoteServer.
7 8 9 10 |
# File 'lib/files.com/models/remote_server.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/remote_server.rb', line 5 def attributes @attributes end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/files.com/models/remote_server.rb', line 5 def @options end |
Class Method Details
.all(params = {}, options = {}) ⇒ Object
211 212 213 |
# File 'lib/files.com/models/remote_server.rb', line 211 def self.all(params = {}, = {}) list(params, ) end |
.create(params = {}, options = {}) ⇒ Object
Parameters:
aws_access_key - string - AWS Access Key.
aws_secret_key - string - AWS secret key.
hostname - string - Hostname.
name - string - Internal reference name for server.
password - string - Password if needed.
port - string - Port.
private_key - string - Private key if needed.
s3_bucket - string - S3 bucket name.
s3_region - string - S3 region.
server_certificate - string - Certificate for this server.
server_type - string - Type of server. Can be ftp, sftp, or s3.
ssl - string - SSL requirements. Can be if_available, require, require_implicit, never.
username - string - Server username if needed.
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
# File 'lib/files.com/models/remote_server.rb', line 245 def self.create(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: aws_access_key must be an String") if params.dig(:aws_access_key) and !params.dig(:aws_access_key).is_a?(String) raise InvalidParameterError.new("Bad parameter: aws_secret_key must be an String") if params.dig(:aws_secret_key) and !params.dig(:aws_secret_key).is_a?(String) raise InvalidParameterError.new("Bad parameter: hostname must be an String") if params.dig(:hostname) and !params.dig(:hostname).is_a?(String) raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String) raise InvalidParameterError.new("Bad parameter: password must be an String") if params.dig(:password) and !params.dig(:password).is_a?(String) raise InvalidParameterError.new("Bad parameter: port must be an String") if params.dig(:port) and !params.dig(:port).is_a?(String) raise InvalidParameterError.new("Bad parameter: private_key must be an String") if params.dig(:private_key) and !params.dig(:private_key).is_a?(String) raise InvalidParameterError.new("Bad parameter: s3_bucket must be an String") if params.dig(:s3_bucket) and !params.dig(:s3_bucket).is_a?(String) raise InvalidParameterError.new("Bad parameter: s3_region must be an String") if params.dig(:s3_region) and !params.dig(:s3_region).is_a?(String) raise InvalidParameterError.new("Bad parameter: server_certificate must be an String") if params.dig(:server_certificate) and !params.dig(:server_certificate).is_a?(String) raise InvalidParameterError.new("Bad parameter: server_type must be an String") if params.dig(:server_type) and !params.dig(:server_type).is_a?(String) raise InvalidParameterError.new("Bad parameter: ssl must be an String") if params.dig(:ssl) and !params.dig(:ssl).is_a?(String) raise InvalidParameterError.new("Bad parameter: username must be an String") if params.dig(:username) and !params.dig(:username).is_a?(String) response, = Api.send_request("/remote_servers", :post, params, ) RemoteServer.new(response.data, ) end |
.delete(id, params = {}, options = {}) ⇒ Object
301 302 303 304 305 306 307 308 309 |
# File 'lib/files.com/models/remote_server.rb', line 301 def self.delete(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id) response, = Api.send_request("/remote_servers/#{params[:id]}", :delete, params, ) response.data end |
.destroy(id, params = {}, options = {}) ⇒ Object
311 312 313 |
# File 'lib/files.com/models/remote_server.rb', line 311 def self.destroy(id, params = {}, = {}) delete(id, params, ) end |
.find(id, params = {}, options = {}) ⇒ Object
Parameters:
id (required) - integer - Remote Server ID.
217 218 219 220 221 222 223 224 225 |
# File 'lib/files.com/models/remote_server.rb', line 217 def self.find(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id) response, = Api.send_request("/remote_servers/#{params[:id]}", :get, params, ) RemoteServer.new(response.data, ) end |
.get(id, params = {}, options = {}) ⇒ Object
227 228 229 |
# File 'lib/files.com/models/remote_server.rb', line 227 def self.get(id, params = {}, = {}) find(id, params, ) end |
.list(params = {}, options = {}) ⇒ Object
Parameters:
page - integer - Current page number.
per_page - integer - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
202 203 204 205 206 207 208 209 |
# File 'lib/files.com/models/remote_server.rb', line 202 def self.list(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer) raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer) raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String) response, = Api.send_request("/remote_servers", :get, params, ) response.data.map { |object| RemoteServer.new(object, ) } end |
.update(id, params = {}, options = {}) ⇒ Object
Parameters:
aws_access_key - string - AWS Access Key.
aws_secret_key - string - AWS secret key.
hostname - string - Hostname.
name - string - Internal reference name for server.
password - string - Password if needed.
port - string - Port.
private_key - string - Private key if needed.
s3_bucket - string - S3 bucket name.
s3_region - string - S3 region.
server_certificate - string - Certificate for this server.
server_type - string - Type of server. Can be ftp, sftp, or s3.
ssl - string - SSL requirements. Can be if_available, require, require_implicit, never.
username - string - Server username if needed.
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
# File 'lib/files.com/models/remote_server.rb', line 278 def self.update(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer) raise InvalidParameterError.new("Bad parameter: aws_access_key must be an String") if params.dig(:aws_access_key) and !params.dig(:aws_access_key).is_a?(String) raise InvalidParameterError.new("Bad parameter: aws_secret_key must be an String") if params.dig(:aws_secret_key) and !params.dig(:aws_secret_key).is_a?(String) raise InvalidParameterError.new("Bad parameter: hostname must be an String") if params.dig(:hostname) and !params.dig(:hostname).is_a?(String) raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String) raise InvalidParameterError.new("Bad parameter: password must be an String") if params.dig(:password) and !params.dig(:password).is_a?(String) raise InvalidParameterError.new("Bad parameter: port must be an String") if params.dig(:port) and !params.dig(:port).is_a?(String) raise InvalidParameterError.new("Bad parameter: private_key must be an String") if params.dig(:private_key) and !params.dig(:private_key).is_a?(String) raise InvalidParameterError.new("Bad parameter: s3_bucket must be an String") if params.dig(:s3_bucket) and !params.dig(:s3_bucket).is_a?(String) raise InvalidParameterError.new("Bad parameter: s3_region must be an String") if params.dig(:s3_region) and !params.dig(:s3_region).is_a?(String) raise InvalidParameterError.new("Bad parameter: server_certificate must be an String") if params.dig(:server_certificate) and !params.dig(:server_certificate).is_a?(String) raise InvalidParameterError.new("Bad parameter: server_type must be an String") if params.dig(:server_type) and !params.dig(:server_type).is_a?(String) raise InvalidParameterError.new("Bad parameter: ssl must be an String") if params.dig(:ssl) and !params.dig(:ssl).is_a?(String) raise InvalidParameterError.new("Bad parameter: username must be an String") if params.dig(:username) and !params.dig(:username).is_a?(String) raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id) response, = Api.send_request("/remote_servers/#{params[:id]}", :patch, params, ) RemoteServer.new(response.data, ) end |
Instance Method Details
#aws_access_key ⇒ Object
string - AWS Access Key.
103 104 105 |
# File 'lib/files.com/models/remote_server.rb', line 103 def aws_access_key @attributes[:aws_access_key] end |
#aws_access_key=(value) ⇒ Object
107 108 109 |
# File 'lib/files.com/models/remote_server.rb', line 107 def aws_access_key=(value) @attributes[:aws_access_key] = value end |
#aws_secret_key ⇒ Object
string - AWS secret key.
112 113 114 |
# File 'lib/files.com/models/remote_server.rb', line 112 def aws_secret_key @attributes[:aws_secret_key] end |
#aws_secret_key=(value) ⇒ Object
116 117 118 |
# File 'lib/files.com/models/remote_server.rb', line 116 def aws_secret_key=(value) @attributes[:aws_secret_key] = value end |
#delete(params = {}) ⇒ Object
175 176 177 178 179 180 181 182 183 |
# File 'lib/files.com/models/remote_server.rb', line 175 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.dig(:id) and !params.dig(:id).is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id) Api.send_request("/remote_servers/#{@attributes[:id]}", :delete, params, @options) end |
#destroy(params = {}) ⇒ Object
185 186 187 |
# File 'lib/files.com/models/remote_server.rb', line 185 def destroy(params = {}) delete(params) end |
#hostname ⇒ Object
string - Hostname or IP address
22 23 24 |
# File 'lib/files.com/models/remote_server.rb', line 22 def hostname @attributes[:hostname] end |
#hostname=(value) ⇒ Object
26 27 28 |
# File 'lib/files.com/models/remote_server.rb', line 26 def hostname=(value) @attributes[:hostname] = value end |
#id ⇒ Object
int64 - Remote server ID
13 14 15 |
# File 'lib/files.com/models/remote_server.rb', line 13 def id @attributes[:id] end |
#id=(value) ⇒ Object
17 18 19 |
# File 'lib/files.com/models/remote_server.rb', line 17 def id=(value) @attributes[:id] = value end |
#name ⇒ Object
string - Internal name for your reference
31 32 33 |
# File 'lib/files.com/models/remote_server.rb', line 31 def name @attributes[:name] end |
#name=(value) ⇒ Object
35 36 37 |
# File 'lib/files.com/models/remote_server.rb', line 35 def name=(value) @attributes[:name] = value end |
#password ⇒ Object
string - Password if needed.
121 122 123 |
# File 'lib/files.com/models/remote_server.rb', line 121 def password @attributes[:password] end |
#password=(value) ⇒ Object
125 126 127 |
# File 'lib/files.com/models/remote_server.rb', line 125 def password=(value) @attributes[:password] = value end |
#port ⇒ Object
int64 - Port for remote server. Not needed for S3.
40 41 42 |
# File 'lib/files.com/models/remote_server.rb', line 40 def port @attributes[:port] end |
#port=(value) ⇒ Object
44 45 46 |
# File 'lib/files.com/models/remote_server.rb', line 44 def port=(value) @attributes[:port] = value end |
#private_key ⇒ Object
string - Private key if needed.
130 131 132 |
# File 'lib/files.com/models/remote_server.rb', line 130 def private_key @attributes[:private_key] end |
#private_key=(value) ⇒ Object
134 135 136 |
# File 'lib/files.com/models/remote_server.rb', line 134 def private_key=(value) @attributes[:private_key] = value end |
#s3_bucket ⇒ Object
string - S3 bucket name
49 50 51 |
# File 'lib/files.com/models/remote_server.rb', line 49 def s3_bucket @attributes[:s3_bucket] end |
#s3_bucket=(value) ⇒ Object
53 54 55 |
# File 'lib/files.com/models/remote_server.rb', line 53 def s3_bucket=(value) @attributes[:s3_bucket] = value end |
#s3_region ⇒ Object
string - S3 region
58 59 60 |
# File 'lib/files.com/models/remote_server.rb', line 58 def s3_region @attributes[:s3_region] end |
#s3_region=(value) ⇒ Object
62 63 64 |
# File 'lib/files.com/models/remote_server.rb', line 62 def s3_region=(value) @attributes[:s3_region] = value end |
#save ⇒ Object
189 190 191 192 193 194 195 196 |
# File 'lib/files.com/models/remote_server.rb', line 189 def save if @attributes[:id] update(@attributes) else new_obj = RemoteServer.create(@attributes, @options) @attributes = new_obj.attributes end end |
#server_certificate ⇒ Object
string - Remote server certificate
67 68 69 |
# File 'lib/files.com/models/remote_server.rb', line 67 def server_certificate @attributes[:server_certificate] end |
#server_certificate=(value) ⇒ Object
71 72 73 |
# File 'lib/files.com/models/remote_server.rb', line 71 def server_certificate=(value) @attributes[:server_certificate] = value end |
#server_type ⇒ Object
string - Remote server type.
76 77 78 |
# File 'lib/files.com/models/remote_server.rb', line 76 def server_type @attributes[:server_type] end |
#server_type=(value) ⇒ Object
80 81 82 |
# File 'lib/files.com/models/remote_server.rb', line 80 def server_type=(value) @attributes[:server_type] = value end |
#ssl ⇒ Object
string - Should we require SSL?
85 86 87 |
# File 'lib/files.com/models/remote_server.rb', line 85 def ssl @attributes[:ssl] end |
#ssl=(value) ⇒ Object
89 90 91 |
# File 'lib/files.com/models/remote_server.rb', line 89 def ssl=(value) @attributes[:ssl] = value end |
#update(params = {}) ⇒ Object
Parameters:
aws_access_key - string - AWS Access Key.
aws_secret_key - string - AWS secret key.
hostname - string - Hostname.
name - string - Internal reference name for server.
password - string - Password if needed.
port - string - Port.
private_key - string - Private key if needed.
s3_bucket - string - S3 bucket name.
s3_region - string - S3 region.
server_certificate - string - Certificate for this server.
server_type - string - Type of server. Can be ftp, sftp, or s3.
ssl - string - SSL requirements. Can be if_available, require, require_implicit, never.
username - string - Server username if needed.
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/files.com/models/remote_server.rb', line 152 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.dig(:id) and !params.dig(:id).is_a?(Integer) raise InvalidParameterError.new("Bad parameter: aws_access_key must be an String") if params.dig(:aws_access_key) and !params.dig(:aws_access_key).is_a?(String) raise InvalidParameterError.new("Bad parameter: aws_secret_key must be an String") if params.dig(:aws_secret_key) and !params.dig(:aws_secret_key).is_a?(String) raise InvalidParameterError.new("Bad parameter: hostname must be an String") if params.dig(:hostname) and !params.dig(:hostname).is_a?(String) raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String) raise InvalidParameterError.new("Bad parameter: password must be an String") if params.dig(:password) and !params.dig(:password).is_a?(String) raise InvalidParameterError.new("Bad parameter: port must be an String") if params.dig(:port) and !params.dig(:port).is_a?(String) raise InvalidParameterError.new("Bad parameter: private_key must be an String") if params.dig(:private_key) and !params.dig(:private_key).is_a?(String) raise InvalidParameterError.new("Bad parameter: s3_bucket must be an String") if params.dig(:s3_bucket) and !params.dig(:s3_bucket).is_a?(String) raise InvalidParameterError.new("Bad parameter: s3_region must be an String") if params.dig(:s3_region) and !params.dig(:s3_region).is_a?(String) raise InvalidParameterError.new("Bad parameter: server_certificate must be an String") if params.dig(:server_certificate) and !params.dig(:server_certificate).is_a?(String) raise InvalidParameterError.new("Bad parameter: server_type must be an String") if params.dig(:server_type) and !params.dig(:server_type).is_a?(String) raise InvalidParameterError.new("Bad parameter: ssl must be an String") if params.dig(:ssl) and !params.dig(:ssl).is_a?(String) raise InvalidParameterError.new("Bad parameter: username must be an String") if params.dig(:username) and !params.dig(:username).is_a?(String) raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id) Api.send_request("/remote_servers/#{@attributes[:id]}", :patch, params, @options) end |
#username ⇒ Object
string - Remote server username. Not needed for S3 buckets.
94 95 96 |
# File 'lib/files.com/models/remote_server.rb', line 94 def username @attributes[:username] end |
#username=(value) ⇒ Object
98 99 100 |
# File 'lib/files.com/models/remote_server.rb', line 98 def username=(value) @attributes[:username] = value end |