Class: Api2Convert::Model::CloudInput
- Inherits:
-
Object
- Object
- Api2Convert::Model::CloudInput
- Defined in:
- lib/api2convert/model/cloud_input.rb
Overview
A cloud-storage input descriptor:
{ type:"cloud", source:<provider>, parameters, credentials }.
Hand it to client.convert / convert_async as the input, or to
client.jobs.add_input(job_id, cloud_input); either way it emits the wire
descriptor via #to_h. Like a remote URL, a cloud input is a started
job (process => true), not a staged upload.
The per-provider factories carry each provider's required keys verbatim
— flat and lowercase, exactly as the API expects (accesskeyid, not
access_key_id). The required keys are constructor arguments (structural
correctness), not a runtime gate: the builder never rejects a descriptor
the permissive, asynchronously-validating server would accept. Optional and
forward-compat keys go through the trailing parameters / credentials
maps, or the generic CloudInput.of escape hatch.
Google Drive input uses the gdrive_picker input type (the generic
add_input raw-map path this wave); gdrive/youtube are output-only.
credentials ride in the plaintext body, so #inspect masks the whole
credentials object to [REDACTED] and any sensitive parameters leaf.
Instance Attribute Summary collapse
-
#credentials ⇒ Object
readonly
Returns the value of attribute credentials.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Class Method Summary collapse
-
.amazon_s3(bucket:, file:, accesskeyid:, secretaccesskey:, parameters: {}, credentials: {}) ⇒ Object
Import from Amazon S3.
-
.azure(container:, file:, accountname:, accountkey:, parameters: {}, credentials: {}) ⇒ Object
Import from Azure Blob Storage.
-
.ftp(host:, file:, username:, password:, parameters: {}, credentials: {}) ⇒ Object
Import from an FTP server.
-
.google_cloud(projectid:, bucket:, file:, keyfile:, parameters: {}, credentials: {}) ⇒ Object
Import from Google Cloud Storage.
-
.of(source, parameters: {}, credentials: {}) ⇒ Object
Generic escape hatch: any provider (a CloudProvider constant or a forward-compat string) with free-form maps.
Instance Method Summary collapse
-
#initialize(source:, parameters: {}, credentials: {}) ⇒ CloudInput
constructor
sourceis the provider string;parametersare non-secret locator keys (bucket,file,host, …);credentialsare secret keys. -
#inspect ⇒ Object
Redacted representation — the whole
credentialsobject renders as[REDACTED]; sensitiveparametersleaves are masked too. -
#to_h ⇒ Object
The wire descriptor sent to
POST /jobs(inlineinput) orPOST /jobs/{id}/input. - #to_s ⇒ Object
Constructor Details
#initialize(source:, parameters: {}, credentials: {}) ⇒ CloudInput
source is the provider string; parameters are non-secret locator keys
(bucket, file, host, …); credentials are secret keys.
31 32 33 34 35 36 |
# File 'lib/api2convert/model/cloud_input.rb', line 31 def initialize(source:, parameters: {}, credentials: {}) @source = source @parameters = parameters @credentials = credentials freeze end |
Instance Attribute Details
#credentials ⇒ Object (readonly)
Returns the value of attribute credentials.
27 28 29 |
# File 'lib/api2convert/model/cloud_input.rb', line 27 def credentials @credentials end |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
27 28 29 |
# File 'lib/api2convert/model/cloud_input.rb', line 27 def parameters @parameters end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
27 28 29 |
# File 'lib/api2convert/model/cloud_input.rb', line 27 def source @source end |
Class Method Details
.amazon_s3(bucket:, file:, accesskeyid:, secretaccesskey:, parameters: {}, credentials: {}) ⇒ Object
Import from Amazon S3. Extra/forward-compat keys merge into
parameters / credentials.
46 47 48 49 50 51 52 53 54 |
# File 'lib/api2convert/model/cloud_input.rb', line 46 def self.amazon_s3(bucket:, file:, accesskeyid:, secretaccesskey:, parameters: {}, credentials: {}) new( source: CloudProvider::AMAZON_S3, parameters: { "bucket" => bucket, "file" => file }.merge(parameters), credentials: { "accesskeyid" => accesskeyid, "secretaccesskey" => secretaccesskey } .merge(credentials) ) end |
.azure(container:, file:, accountname:, accountkey:, parameters: {}, credentials: {}) ⇒ Object
Import from Azure Blob Storage.
57 58 59 60 61 62 63 64 |
# File 'lib/api2convert/model/cloud_input.rb', line 57 def self.azure(container:, file:, accountname:, accountkey:, parameters: {}, credentials: {}) new( source: CloudProvider::AZURE, parameters: { "container" => container, "file" => file }.merge(parameters), credentials: { "accountname" => accountname, "accountkey" => accountkey }.merge(credentials) ) end |
.ftp(host:, file:, username:, password:, parameters: {}, credentials: {}) ⇒ Object
Import from an FTP server.
67 68 69 70 71 72 73 |
# File 'lib/api2convert/model/cloud_input.rb', line 67 def self.ftp(host:, file:, username:, password:, parameters: {}, credentials: {}) new( source: CloudProvider::FTP, parameters: { "host" => host, "file" => file }.merge(parameters), credentials: { "username" => username, "password" => password }.merge(credentials) ) end |
.google_cloud(projectid:, bucket:, file:, keyfile:, parameters: {}, credentials: {}) ⇒ Object
Import from Google Cloud Storage.
76 77 78 79 80 81 82 |
# File 'lib/api2convert/model/cloud_input.rb', line 76 def self.google_cloud(projectid:, bucket:, file:, keyfile:, parameters: {}, credentials: {}) new( source: CloudProvider::GOOGLE_CLOUD, parameters: { "projectid" => projectid, "bucket" => bucket, "file" => file }.merge(parameters), credentials: { "keyfile" => keyfile }.merge(credentials) ) end |
.of(source, parameters: {}, credentials: {}) ⇒ Object
Generic escape hatch: any provider (a CloudProvider constant or a forward-compat string) with free-form maps.
40 41 42 |
# File 'lib/api2convert/model/cloud_input.rb', line 40 def self.of(source, parameters: {}, credentials: {}) new(source: source.to_s, parameters: parameters, credentials: credentials) end |
Instance Method Details
#inspect ⇒ Object
Redacted representation — the whole credentials object renders as
[REDACTED]; sensitive parameters leaves are masked too. Safe to log.
97 98 99 100 101 |
# File 'lib/api2convert/model/cloud_input.rb', line 97 def inspect "#<#{self.class.name} type=cloud source=#{@source.inspect} " \ "parameters=#{Support::Redactor.parameters(@parameters).inspect} " \ "credentials=#{Support::Redactor::MARKER}>" end |
#to_h ⇒ Object
The wire descriptor sent to POST /jobs (inline input) or
POST /jobs/{id}/input.
86 87 88 89 90 91 92 93 |
# File 'lib/api2convert/model/cloud_input.rb', line 86 def to_h { "type" => InputType::CLOUD, "source" => @source, "parameters" => @parameters, "credentials" => @credentials } end |
#to_s ⇒ Object
103 104 105 |
# File 'lib/api2convert/model/cloud_input.rb', line 103 def to_s inspect end |