Class: Vapi::CreateGcpCredentialDto

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(provider:, gcp_key:, name: OMIT, bucket_plan: OMIT, additional_properties: nil) ⇒ Vapi::CreateGcpCredentialDto

Parameters:

  • provider (String)
  • name (String) (defaults to: OMIT)

    This is the name of the GCP 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.

  • bucket_plan (Vapi::BucketPlan) (defaults to: OMIT)

    This is the bucket plan that can be provided to store call artifacts in GCP.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/vapi_server_sdk/types/create_gcp_credential_dto.rb', line 38

def initialize(provider:, gcp_key:, name: OMIT, bucket_plan: OMIT, additional_properties: nil)
  @provider = provider
  @name = name if name != OMIT
  @gcp_key = gcp_key
  @bucket_plan = bucket_plan if bucket_plan != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "provider": provider,
    "name": name,
    "gcpKey": gcp_key,
    "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



22
23
24
# File 'lib/vapi_server_sdk/types/create_gcp_credential_dto.rb', line 22

def additional_properties
  @additional_properties
end

#bucket_planVapi::BucketPlan (readonly)

Returns This is the bucket plan that can be provided to store call artifacts in GCP.

Returns:

  • (Vapi::BucketPlan)

    This is the bucket plan that can be provided to store call artifacts in GCP.



20
21
22
# File 'lib/vapi_server_sdk/types/create_gcp_credential_dto.rb', line 20

def bucket_plan
  @bucket_plan
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.



18
19
20
# File 'lib/vapi_server_sdk/types/create_gcp_credential_dto.rb', line 18

def gcp_key
  @gcp_key
end

#nameString (readonly)

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

Returns:

  • (String)

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



13
14
15
# File 'lib/vapi_server_sdk/types/create_gcp_credential_dto.rb', line 13

def name
  @name
end

#providerString (readonly)

Returns:

  • (String)


11
12
13
# File 'lib/vapi_server_sdk/types/create_gcp_credential_dto.rb', line 11

def provider
  @provider
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::CreateGcpCredentialDto

Deserialize a JSON object to an instance of CreateGcpCredentialDto

Parameters:

  • json_object (String)

Returns:



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

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  provider = parsed_json["provider"]
  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
  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,
    name: name,
    gcp_key: gcp_key,
    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)


97
98
99
100
101
102
# File 'lib/vapi_server_sdk/types/create_gcp_credential_dto.rb', line 97

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.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.bucket_plan.nil? || Vapi::BucketPlan.validate_raw(obj: obj.bucket_plan)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of CreateGcpCredentialDto to a JSON object

Returns:

  • (String)


87
88
89
# File 'lib/vapi_server_sdk/types/create_gcp_credential_dto.rb', line 87

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