Class: Svix::AppPortalAccessIn

Inherits:
Object
  • Object
show all
Defined in:
lib/svix/models/app_portal_access_in.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AppPortalAccessIn

Returns a new instance of AppPortalAccessIn.



45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/svix/models/app_portal_access_in.rb', line 45

def initialize(attributes = {})
  unless attributes.is_a?(Hash)
    fail(ArgumentError, "The input argument (attributes) must be a hash in `Svix::AppPortalAccessIn` new method")
  end

  attributes.each do |k, v|
    unless ALL_FIELD.include?(k.to_s)
      fail(ArgumentError, "The field #{k} is not part of Svix::AppPortalAccessIn")
    end

    instance_variable_set("@#{k}", v)
    instance_variable_set("@__#{k}_is_defined", true)
  end
end

Instance Attribute Details

#applicationObject

Optionally creates a new application while generating the access link.

If the application id or uid that is used in the path already exists, this argument is ignored.



10
11
12
# File 'lib/svix/models/app_portal_access_in.rb', line 10

def application
  @application
end

#capabilitiesObject

Custom capabilities attached to the token, You can combine as many capabilities as necessary.

The ‘ViewBase` capability is always required

  • ‘ViewBase`: Basic read only permissions, does not allow the user to see the endpoint secret.

  • ‘ViewEndpointSecret`: Allows user to view the endpoint secret.

  • ‘ManageEndpointSecret`: Allows user to rotate and view the endpoint secret.

  • ‘ManageTransformations`: Allows user to modify the endpoint transformations.

  • ‘CreateAttempts`: Allows user to replay missing messages and send example messages.

  • ‘ManageEndpoint`: Allows user to read/modify any field or configuration of an endpoint (including secrets)

By default, the token will get all capabilities if the capabilities are not explicitly specified.



28
29
30
# File 'lib/svix/models/app_portal_access_in.rb', line 28

def capabilities
  @capabilities
end

#expiryObject

How long the token will be valid for, in seconds.

Valid values are between 1 hour and 7 days. The default is 7 days.



32
33
34
# File 'lib/svix/models/app_portal_access_in.rb', line 32

def expiry
  @expiry
end

#feature_flagsObject

The set of feature flags the created token will have access to.



34
35
36
# File 'lib/svix/models/app_portal_access_in.rb', line 34

def feature_flags
  @feature_flags
end

#read_onlyObject

Whether the app portal should be in read-only mode.



36
37
38
# File 'lib/svix/models/app_portal_access_in.rb', line 36

def read_only
  @read_only
end

#session_idObject

An optional session ID to attach to the token.

When expiring tokens with “Expire All”, you can include the session ID to only expire tokens that were created with that session ID.



40
41
42
# File 'lib/svix/models/app_portal_access_in.rb', line 40

def session_id
  @session_id
end

Class Method Details

.deserialize(attributes = {}) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/svix/models/app_portal_access_in.rb', line 60

def self.deserialize(attributes = {})
  attributes = attributes.transform_keys(&:to_s)
  attrs = Hash.new
  attrs["application"] = Svix::ApplicationIn.deserialize(attributes["application"]) if attributes["application"]
  if attributes["capabilities"]
    attrs["capabilities"] = attributes["capabilities"].map { |v| Svix::AppPortalCapability.deserialize(v) }
  end

  attrs["expiry"] = attributes["expiry"]
  attrs["feature_flags"] = attributes["featureFlags"]
  attrs["read_only"] = attributes["readOnly"]
  attrs["session_id"] = attributes["sessionId"]
  new(attrs)
end

Instance Method Details

#serializeObject



75
76
77
78
79
80
81
82
83
84
# File 'lib/svix/models/app_portal_access_in.rb', line 75

def serialize
  out = Hash.new
  out["application"] = Svix::serialize_schema_ref(@application) if @application
  out["capabilities"] = @capabilities.map { |v| v.serialize } if @capabilities
  out["expiry"] = Svix::serialize_primitive(@expiry) if @expiry
  out["featureFlags"] = Svix::serialize_primitive(@feature_flags) if @feature_flags
  out["readOnly"] = Svix::serialize_primitive(@read_only) if @read_only
  out["sessionId"] = Svix::serialize_primitive(@session_id) if @session_id
  out
end

#to_jsonObject

Serializes the object to a json string

Returns:

  • String



88
89
90
# File 'lib/svix/models/app_portal_access_in.rb', line 88

def to_json
  JSON.dump(serialize)
end