Class: Vapi::GcpCredential

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(provider:, id:, org_id:, created_at:, updated_at:, gcp_key:, fallback_index: OMIT, name: OMIT, region: OMIT, bucket_plan: OMIT, additional_properties: nil) ⇒ Vapi::GcpCredential

Parameters:

  • provider (String)
  • fallback_index (Float) (defaults to: OMIT)

    This is the order in which this storage provider is tried during upload retries. Lower numbers are tried first in increasing order.

  • id (String)

    This is the unique identifier for the credential.

  • org_id (String)

    This is the unique identifier for the org that this credential belongs to.

  • created_at (DateTime)

    This is the ISO 8601 date-time string of when the credential was created.

  • updated_at (DateTime)

    This is the ISO 8601 date-time string of when the assistant was last updated.

  • name (String) (defaults to: OMIT)

    This is the name of credential. This is just for your reference.

  • gcp_key (Vapi::GcpKey)

    This is the GCP key. This is the JSON that can be generated in the Google Cloud Console at le.cloud.google.com/iam-admin/serviceaccounts/details/<service-account-id>/keys. The schema is identical to the JSON that GCP outputs.

  • region (String) (defaults to: OMIT)

    This is the region of the GCP resource.

  • bucket_plan (Vapi::BucketPlan) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/vapi_server_sdk/types/gcp_credential.rb', line 59

def initialize(provider:, id:, org_id:, created_at:, updated_at:, gcp_key:, fallback_index: OMIT, name: OMIT,
               region: OMIT, bucket_plan: OMIT, additional_properties: nil)
  @provider = provider
  @fallback_index = fallback_index if fallback_index != OMIT
  @id = id
  @org_id = org_id
  @created_at = created_at
  @updated_at = updated_at
  @name = name if name != OMIT
  @gcp_key = gcp_key
  @region = region if region != OMIT
  @bucket_plan = bucket_plan if bucket_plan != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "provider": provider,
    "fallbackIndex": fallback_index,
    "id": id,
    "orgId": org_id,
    "createdAt": created_at,
    "updatedAt": updated_at,
    "name": name,
    "gcpKey": gcp_key,
    "region": region,
    "bucketPlan": bucket_plan
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



36
37
38
# File 'lib/vapi_server_sdk/types/gcp_credential.rb', line 36

def additional_properties
  @additional_properties
end

#bucket_planVapi::BucketPlan (readonly)

Returns:



34
35
36
# File 'lib/vapi_server_sdk/types/gcp_credential.rb', line 34

def bucket_plan
  @bucket_plan
end

#created_atDateTime (readonly)

Returns This is the ISO 8601 date-time string of when the credential was created.

Returns:

  • (DateTime)

    This is the ISO 8601 date-time string of when the credential was created.



21
22
23
# File 'lib/vapi_server_sdk/types/gcp_credential.rb', line 21

def created_at
  @created_at
end

#fallback_indexFloat (readonly)

Returns This is the order in which this storage provider is tried during upload retries. Lower numbers are tried first in increasing order.

Returns:

  • (Float)

    This is the order in which this storage provider is tried during upload retries. Lower numbers are tried first in increasing order.



15
16
17
# File 'lib/vapi_server_sdk/types/gcp_credential.rb', line 15

def fallback_index
  @fallback_index
end

#gcp_keyVapi::GcpKey (readonly)

Returns This is the GCP key. This is the JSON that can be generated in the Google Cloud Console at le.cloud.google.com/iam-admin/serviceaccounts/details/<service-account-id>/keys. The schema is identical to the JSON that GCP outputs.

Returns:

  • (Vapi::GcpKey)

    This is the GCP key. This is the JSON that can be generated in the Google Cloud Console at le.cloud.google.com/iam-admin/serviceaccounts/details/<service-account-id>/keys. The schema is identical to the JSON that GCP outputs.



30
31
32
# File 'lib/vapi_server_sdk/types/gcp_credential.rb', line 30

def gcp_key
  @gcp_key
end

#idString (readonly)

Returns This is the unique identifier for the credential.

Returns:

  • (String)

    This is the unique identifier for the credential.



17
18
19
# File 'lib/vapi_server_sdk/types/gcp_credential.rb', line 17

def id
  @id
end

#nameString (readonly)

Returns This is the name of credential. This is just for your reference.

Returns:

  • (String)

    This is the name of credential. This is just for your reference.



25
26
27
# File 'lib/vapi_server_sdk/types/gcp_credential.rb', line 25

def name
  @name
end

#org_idString (readonly)

Returns This is the unique identifier for the org that this credential belongs to.

Returns:

  • (String)

    This is the unique identifier for the org that this credential belongs to.



19
20
21
# File 'lib/vapi_server_sdk/types/gcp_credential.rb', line 19

def org_id
  @org_id
end

#providerString (readonly)

Returns:

  • (String)


12
13
14
# File 'lib/vapi_server_sdk/types/gcp_credential.rb', line 12

def provider
  @provider
end

#regionString (readonly)

Returns This is the region of the GCP resource.

Returns:

  • (String)

    This is the region of the GCP resource.



32
33
34
# File 'lib/vapi_server_sdk/types/gcp_credential.rb', line 32

def region
  @region
end

#updated_atDateTime (readonly)

Returns This is the ISO 8601 date-time string of when the assistant was last updated.

Returns:

  • (DateTime)

    This is the ISO 8601 date-time string of when the assistant was last updated.



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

def updated_at
  @updated_at
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::GcpCredential

Deserialize a JSON object to an instance of GcpCredential

Parameters:

  • json_object (String)

Returns:



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/vapi_server_sdk/types/gcp_credential.rb', line 92

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  provider = parsed_json["provider"]
  fallback_index = parsed_json["fallbackIndex"]
  id = parsed_json["id"]
  org_id = parsed_json["orgId"]
  created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?)
  updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?)
  name = parsed_json["name"]
  if parsed_json["gcpKey"].nil?
    gcp_key = nil
  else
    gcp_key = parsed_json["gcpKey"].to_json
    gcp_key = Vapi::GcpKey.from_json(json_object: gcp_key)
  end
  region = parsed_json["region"]
  if parsed_json["bucketPlan"].nil?
    bucket_plan = nil
  else
    bucket_plan = parsed_json["bucketPlan"].to_json
    bucket_plan = Vapi::BucketPlan.from_json(json_object: bucket_plan)
  end
  new(
    provider: provider,
    fallback_index: fallback_index,
    id: id,
    org_id: org_id,
    created_at: created_at,
    updated_at: updated_at,
    name: name,
    gcp_key: gcp_key,
    region: region,
    bucket_plan: bucket_plan,
    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)


143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/vapi_server_sdk/types/gcp_credential.rb', line 143

def self.validate_raw(obj:)
  obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.")
  obj.fallback_index&.is_a?(Float) != false || raise("Passed value for field obj.fallback_index is not the expected type, validation failed.")
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.")
  obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.")
  obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.")
  obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  Vapi::GcpKey.validate_raw(obj: obj.gcp_key)
  obj.region&.is_a?(String) != false || raise("Passed value for field obj.region is not the expected type, validation failed.")
  obj.bucket_plan.nil? || Vapi::BucketPlan.validate_raw(obj: obj.bucket_plan)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of GcpCredential to a JSON object

Returns:

  • (String)


133
134
135
# File 'lib/vapi_server_sdk/types/gcp_credential.rb', line 133

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