Class: NgrokAPI::Models::ReservedDomain

Inherits:
Object
  • Object
show all
Defined in:
lib/ngrokapi/models/reserved_domain.rb

Overview

A resource representing data from the reserved_domains API

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:, result:) ⇒ ReservedDomain

Returns a new instance of ReservedDomain.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/ngrokapi/models/reserved_domain.rb', line 24

def initialize(client:, result:)
  @client = client
  @result = result
  @created_at = @result['created_at']
  @certificate = @result['certificate']
  @certificate_management_policy = @result['certificate_management_policy']
  @certificate_management_status = @result['certificate_management_status']
  @cname_target = @result['cname_target']
  @description = @result['description']
  @domain = @result['domain']
  @http_endpoint_configuration = @result['http_endpoint_configuration']
  @https_endpoint_configuration = @result['https_endpoint_configuration']
  @id = @result['id']
  @metadata = @result['metadata']
  @region = @result['region']
  @uri = @result['uri']
end

Instance Attribute Details

#certificateObject (readonly)

Returns the value of attribute certificate.



8
9
10
# File 'lib/ngrokapi/models/reserved_domain.rb', line 8

def certificate
  @certificate
end

#certificate_management_policyObject (readonly)

Returns the value of attribute certificate_management_policy.



8
9
10
# File 'lib/ngrokapi/models/reserved_domain.rb', line 8

def certificate_management_policy
  @certificate_management_policy
end

#certificate_management_statusObject (readonly)

Returns the value of attribute certificate_management_status.



8
9
10
# File 'lib/ngrokapi/models/reserved_domain.rb', line 8

def certificate_management_status
  @certificate_management_status
end

#clientObject (readonly)

Returns the value of attribute client.



8
9
10
# File 'lib/ngrokapi/models/reserved_domain.rb', line 8

def client
  @client
end

#cname_targetObject (readonly)

Returns the value of attribute cname_target.



8
9
10
# File 'lib/ngrokapi/models/reserved_domain.rb', line 8

def cname_target
  @cname_target
end

#created_atObject (readonly)

Returns the value of attribute created_at.



8
9
10
# File 'lib/ngrokapi/models/reserved_domain.rb', line 8

def created_at
  @created_at
end

#descriptionObject (readonly)

Returns the value of attribute description.



8
9
10
# File 'lib/ngrokapi/models/reserved_domain.rb', line 8

def description
  @description
end

#domainObject (readonly)

Returns the value of attribute domain.



8
9
10
# File 'lib/ngrokapi/models/reserved_domain.rb', line 8

def domain
  @domain
end

#http_endpoint_configurationObject (readonly)

Returns the value of attribute http_endpoint_configuration.



8
9
10
# File 'lib/ngrokapi/models/reserved_domain.rb', line 8

def http_endpoint_configuration
  @http_endpoint_configuration
end

#https_endpoint_configurationObject (readonly)

Returns the value of attribute https_endpoint_configuration.



8
9
10
# File 'lib/ngrokapi/models/reserved_domain.rb', line 8

def https_endpoint_configuration
  @https_endpoint_configuration
end

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/ngrokapi/models/reserved_domain.rb', line 8

def id
  @id
end

#metadataObject (readonly)

Returns the value of attribute metadata.



8
9
10
# File 'lib/ngrokapi/models/reserved_domain.rb', line 8

def 
  @metadata
end

#regionObject (readonly)

Returns the value of attribute region.



8
9
10
# File 'lib/ngrokapi/models/reserved_domain.rb', line 8

def region
  @region
end

#resultObject (readonly)

Returns the value of attribute result.



8
9
10
# File 'lib/ngrokapi/models/reserved_domain.rb', line 8

def result
  @result
end

#uriObject (readonly)

Returns the value of attribute uri.



8
9
10
# File 'lib/ngrokapi/models/reserved_domain.rb', line 8

def uri
  @uri
end

Instance Method Details

#==(other) ⇒ Object



42
43
44
# File 'lib/ngrokapi/models/reserved_domain.rb', line 42

def ==(other)
  @result == other.result
end

#deletenil

Delete this reserved domain.

ngrok.com/docs/api#api-reserved-domains-delete

Returns:

  • (nil)

    result from delete request



56
57
58
# File 'lib/ngrokapi/models/reserved_domain.rb', line 56

def delete
  @client.delete(id: @id)
end

#delete_certificatenil

Detach the certificate attached from this reserved domain.

ngrok.com/docs/api#api-reserved-domains-delete-certificate

Returns:

  • (nil)

    result from delete request



113
114
115
116
# File 'lib/ngrokapi/models/reserved_domain.rb', line 113

def delete_certificate
  @certificate = nil
  @client.delete_certificate(id: @id)
end

#delete_certificate_management_policynil

Detach the certificate management policy attached from this reserved domain.

ngrok.com/docs/api#api-reserved-domains-delete-certificate-management-policy

Returns:

  • (nil)

    result from delete request



124
125
126
127
128
# File 'lib/ngrokapi/models/reserved_domain.rb', line 124

def delete_certificate_management_policy
  @certificate_management_policy = nil
  @certificate_management_status = nil
  @client.delete_certificate_management_policy(id: @id)
end

#delete_http_endpoint_confignil

Detach the http endpoint configuration attached from this reserved domain.

ngrok.com/docs/api#api-reserved-domains-delete-http-endpoint-config

Returns:

  • (nil)

    result from delete request



136
137
138
139
# File 'lib/ngrokapi/models/reserved_domain.rb', line 136

def delete_http_endpoint_config
  @http_endpoint_configuration = nil
  @client.delete_http_endpoint_config(id: @id)
end

#delete_https_endpoint_confignil

Detach the https endpoint configuration attached from this reserved domain.

ngrok.com/docs/api#api-reserved-domains-delete-https-endpoint-config

Returns:

  • (nil)

    result from delete request



147
148
149
150
# File 'lib/ngrokapi/models/reserved_domain.rb', line 147

def delete_https_endpoint_config
  @https_endpoint_configuration = nil
  @client.delete_https_endpoint_config(id: @id)
end

#restore_certificateNgrokAPI::Models::ReservedDomain

Restore the certificate attached to this reserved domain. Only works if the @result is still present from a previous action

ngrok.com/docs/api#api-reserved-domains-update

Returns:



159
160
161
162
# File 'lib/ngrokapi/models/reserved_domain.rb', line 159

def restore_certificate
  @certificate = @result['certificate']
  @client.update(id: @id, certificate_id: @result['certificate']['id'])
end

#restore_certificate_management_policyNgrokAPI::Models::ReservedDomain

Restore the certificate management policy attached to this reserved domain. Only works if the @result is still present from a previous action

ngrok.com/docs/api#api-reserved-domains-update

Returns:



171
172
173
174
175
176
177
178
# File 'lib/ngrokapi/models/reserved_domain.rb', line 171

def restore_certificate_management_policy
  @certificate_management_policy = @result['certificate_management_policy']
  @certificate_management_status = @result['certificate_management_status']
  @client.update(
    id: @id,
    certificate_management_policy: @result['certificate_management_policy']
  )
end

#restore_http_endpoint_configNgrokAPI::Models::ReservedDomain

Restore the http endpoint configuration attached to this reserved domain. Only works if the @result is still present from a previous action

ngrok.com/docs/api#api-reserved-domains-update

Returns:



187
188
189
190
191
192
193
# File 'lib/ngrokapi/models/reserved_domain.rb', line 187

def restore_http_endpoint_config
  @http_endpoint_configuration = @result['http_endpoint_configuration']
  @client.update(
    id: @id,
    http_endpoint_configuration_id: @result['http_endpoint_configuration']['id']
  )
end

#restore_https_endpoint_configNgrokAPI::Models::ReservedDomain

Restore the https endpoint configuration attached to this reserved domain. Only works if the @result is still present from a previous action

ngrok.com/docs/api#api-reserved-domains-update

Returns:



202
203
204
205
206
207
208
# File 'lib/ngrokapi/models/reserved_domain.rb', line 202

def restore_https_endpoint_config
  @https_endpoint_configuration = @result['https_endpoint_configuration']
  @client.update(
    id: @id,
    https_endpoint_configuration_id: @result['https_endpoint_configuration']['id']
  )
end

#to_sObject



46
47
48
# File 'lib/ngrokapi/models/reserved_domain.rb', line 46

def to_s
  @result.to_s
end

#update(certificate_id: nil, certificate_management_policy: nil, description: '', http_endpoint_configuration_id: nil, https_endpoint_configuration_id: nil, metadata: '') ⇒ NgrokAPI::Models::ReservedDomain

Update the attributes of this reserved domain.

ngrok.com/docs/api#api-reserved-domains-update

Parameters:

  • description (string) (defaults to: '')

    human-readable description of what this reserved domain will be used for

  • metadata (string) (defaults to: '')

    arbitrary user-defined machine-readable data of this reserved domain. Optional, max 4096 bytes.

  • http_endpoint_configuration_id (string) (defaults to: nil)

    ID of an endpoint configuration of type http that will be used to handle inbound http traffic to this domain

  • https_endpoint_configuration_id (string) (defaults to: nil)

    ID of an endpoint configuration of type https that will be used to handle inbound https traffic to this domain

  • certificate_id (string) (defaults to: nil)

    ID of a user-uploaded TLS certificate to use for connections to targeting this domain. Optional, mutually exclusive with “certificate_management_policy“.

  • certificate_management_policy (string) (defaults to: nil)

    configuration for automatic management of TLS certificates for this domain, or null if automatic management is disabled. Optional, mutually exclusive with “certificate_id“.

Returns:



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/ngrokapi/models/reserved_domain.rb', line 74

def update(
  certificate_id: nil,
  certificate_management_policy: nil,
  description: '',
  http_endpoint_configuration_id: nil,
  https_endpoint_configuration_id: nil,
  metadata: ''
)
  if certificate_management_policy
    @certificate_management_policy = certificate_management_policy
  end
  @description = description if description
  @metadata =  if 
  @client.update(
    id: @id,
    description: description,
    metadata: ,
    http_endpoint_configuration_id: http_endpoint_configuration_id,
    https_endpoint_configuration_id: https_endpoint_configuration_id,
    certificate_id: certificate_id,
    certificate_management_policy: certificate_management_policy
  )
  # TODO: update @certificate, etc?
  # @certificate = new_result['certificate'] if certificate_id && new_result['certificate']
  # if http_endpoint_configuration_id
  #   @http_endpoint_configuration_id = http_endpoint_configuration_id
  # end
  # if https_endpoint_configuration_id
  #   @https_endpoint_configuration_id = https_endpoint_configuration_id
  # end
end