Class: Vapi::BucketPlan

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/bucket_plan.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, region: OMIT, path: OMIT, hmac_access_key: OMIT, hmac_secret: OMIT, additional_properties: nil) ⇒ Vapi::BucketPlan

Parameters:

  • name (String) —

    This is the name of the bucket.

  • region (String) (defaults to: OMIT) —

    This is the region of the bucket. Usage:

    • If credential.type is aws, then this is required.
    • If credential.type is gcp, then this is optional since GCP allows buckets to be accessed without a region but region is required for data residency requirements. Read here: https://cloud.google.com/storage/docs/request-endpoints
  • path (String) (defaults to: OMIT) —

    This is the path where call artifacts will be stored. Usage:

    • To store call artifacts in a specific folder, set this to the full path. Eg. "/folder-name1/folder-name2".
    • To store call artifacts in the root of the bucket, leave this blank. @default "/"
  • hmac_access_key (String) (defaults to: OMIT) —

    This is the HMAC access key offered by GCP for interoperability with S3 clients. Here is the guide on how to create: https://cloud.google.com/storage/docs/authentication/managing-hmackeys#console Usage:

    • If credential.type is gcp, then this is required.
    • If credential.type is aws, then this is not required since credential.awsAccessKeyId is used instead.
  • hmac_secret (String) (defaults to: OMIT) —

    This is the secret for the HMAC access key. Here is the guide on how to create: https://cloud.google.com/storage/docs/authentication/managing-hmackeys#console Usage:

    • If credential.type is gcp, then this is required.
    • If credential.type is aws, then this is not required since credential.awsSecretAccessKey is used instead. Note: This is not returned in the API.
  • additional_properties (OpenStruct) (defaults to: nil) —

    Additional properties unmapped to the current class definition



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/vapi_server_sdk/types/bucket_plan.rb', line 77

def initialize(name:, region: OMIT, path: OMIT, hmac_access_key: OMIT, hmac_secret: OMIT,
               additional_properties: nil)
  @name = name
  @region = region if region != OMIT
  @path = path if path != OMIT
  @hmac_access_key = hmac_access_key if hmac_access_key != OMIT
  @hmac_secret = hmac_secret if hmac_secret != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "name": name,
    "region": region,
    "path": path,
    "hmacAccessKey": hmac_access_key,
    "hmacSecret": hmac_secret
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_properties ⇒ OpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct) —

    Additional properties unmapped to the current class definition



41
42
43
# File 'lib/vapi_server_sdk/types/bucket_plan.rb', line 41

def additional_properties
  @additional_properties
end

#hmac_access_key ⇒ String (readonly)

Returns This is the HMAC access key offered by GCP for interoperability with S3 clients. Here is the guide on how to create: https://cloud.google.com/storage/docs/authentication/managing-hmackeys#console Usage:

  • If credential.type is gcp, then this is required.
  • If credential.type is aws, then this is not required since credential.awsAccessKeyId is used instead.

Returns:



31
32
33
# File 'lib/vapi_server_sdk/types/bucket_plan.rb', line 31

def hmac_access_key
  @hmac_access_key
end

#hmac_secret ⇒ String (readonly)

Returns This is the secret for the HMAC access key. Here is the guide on how to create: https://cloud.google.com/storage/docs/authentication/managing-hmackeys#console Usage:

  • If credential.type is gcp, then this is required.
  • If credential.type is aws, then this is not required since credential.awsSecretAccessKey is used instead. Note: This is not returned in the API.

Returns:



39
40
41
# File 'lib/vapi_server_sdk/types/bucket_plan.rb', line 39

def hmac_secret
  @hmac_secret
end

#name ⇒ String (readonly)

Returns This is the name of the bucket.

Returns:

  • (String) —

    This is the name of the bucket.



9
10
11
# File 'lib/vapi_server_sdk/types/bucket_plan.rb', line 9

def name
  @name
end

#path ⇒ String (readonly)

Returns This is the path where call artifacts will be stored. Usage:

  • To store call artifacts in a specific folder, set this to the full path. Eg. "/folder-name1/folder-name2".
  • To store call artifacts in the root of the bucket, leave this blank. @default "/".

Returns:

  • (String) —

    This is the path where call artifacts will be stored. Usage:

    • To store call artifacts in a specific folder, set this to the full path. Eg. "/folder-name1/folder-name2".
    • To store call artifacts in the root of the bucket, leave this blank. @default "/"


23
24
25
# File 'lib/vapi_server_sdk/types/bucket_plan.rb', line 23

def path
  @path
end

#region ⇒ String (readonly)

Returns This is the region of the bucket. Usage:

  • If credential.type is aws, then this is required.
  • If credential.type is gcp, then this is optional since GCP allows buckets to be accessed without a region but region is required for data residency requirements. Read here: https://cloud.google.com/storage/docs/request-endpoints.

Returns:

  • (String) —

    This is the region of the bucket. Usage:

    • If credential.type is aws, then this is required.
    • If credential.type is gcp, then this is optional since GCP allows buckets to be accessed without a region but region is required for data residency requirements. Read here: https://cloud.google.com/storage/docs/request-endpoints


16
17
18
# File 'lib/vapi_server_sdk/types/bucket_plan.rb', line 16

def region
  @region
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::BucketPlan

Deserialize a JSON object to an instance of BucketPlan

Parameters:

  • json_object (String)

Returns:



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/vapi_server_sdk/types/bucket_plan.rb', line 100

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  name = parsed_json["name"]
  region = parsed_json["region"]
  path = parsed_json["path"]
  hmac_access_key = parsed_json["hmacAccessKey"]
  hmac_secret = parsed_json["hmacSecret"]
  new(
    name: name,
    region: region,
    path: path,
    hmac_access_key: hmac_access_key,
    hmac_secret: hmac_secret,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


131
132
133
134
135
136
137
# File 'lib/vapi_server_sdk/types/bucket_plan.rb', line 131

def self.validate_raw(obj:)
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.region&.is_a?(String) != false || raise("Passed value for field obj.region is not the expected type, validation failed.")
  obj.path&.is_a?(String) != false || raise("Passed value for field obj.path is not the expected type, validation failed.")
  obj.hmac_access_key&.is_a?(String) != false || raise("Passed value for field obj.hmac_access_key is not the expected type, validation failed.")
  obj.hmac_secret&.is_a?(String) != false || raise("Passed value for field obj.hmac_secret is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of BucketPlan to a JSON object

Returns:

  • (String)


121
122
123
# File 'lib/vapi_server_sdk/types/bucket_plan.rb', line 121

def to_json(*_args)
  @_field_set&.to_json
end