Class: Appwrite::Proxy
- Defined in:
- lib/appwrite/services/proxy.rb
Instance Method Summary collapse
-
#create_api_rule(domain:) ⇒ ProxyRule
Create a new proxy rule for serving Appwrite’s API on custom domain.
-
#create_function_rule(domain:, function_id:, branch: nil) ⇒ ProxyRule
Create a new proxy rule for executing Appwrite Function on custom domain.
-
#create_redirect_rule(domain:, url:, status_code:, resource_id:, resource_type:) ⇒ ProxyRule
Create a new proxy rule for to redirect from custom domain to another domain.
-
#create_site_rule(domain:, site_id:, branch: nil) ⇒ ProxyRule
Create a new proxy rule for serving Appwrite Site on custom domain.
-
#delete_rule(rule_id:) ⇒ Object
Delete a proxy rule by its unique ID.
-
#get_rule(rule_id:) ⇒ ProxyRule
Get a proxy rule by its unique ID.
-
#initialize(client) ⇒ Proxy
constructor
A new instance of Proxy.
-
#list_rules(queries: nil, total: nil) ⇒ ProxyRuleList
Get a list of all the proxy rules.
-
#update_rule_status(rule_id:) ⇒ ProxyRule
If not succeeded yet, retry verification process of a proxy rule domain.
Constructor Details
#initialize(client) ⇒ Proxy
Returns a new instance of Proxy.
6 7 8 |
# File 'lib/appwrite/services/proxy.rb', line 6 def initialize(client) @client = client end |
Instance Method Details
#create_api_rule(domain:) ⇒ ProxyRule
Create a new proxy rule for serving Appwrite’s API on custom domain.
Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/appwrite/services/proxy.rb', line 46 def create_api_rule(domain:) api_path = '/proxy/rules/api' if domain.nil? raise Appwrite::Exception.new('Missing required parameter: "domain"') end api_params = { domain: domain, } api_headers = { "content-type": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::ProxyRule ) end |
#create_function_rule(domain:, function_id:, branch: nil) ⇒ ProxyRule
Create a new proxy rule for executing Appwrite Function on custom domain.
Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/appwrite/services/proxy.rb', line 81 def create_function_rule(domain:, function_id:, branch: nil) api_path = '/proxy/rules/function' if domain.nil? raise Appwrite::Exception.new('Missing required parameter: "domain"') end if function_id.nil? raise Appwrite::Exception.new('Missing required parameter: "functionId"') end api_params = { domain: domain, functionId: function_id, branch: branch, } api_headers = { "content-type": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::ProxyRule ) end |
#create_redirect_rule(domain:, url:, status_code:, resource_id:, resource_type:) ⇒ ProxyRule
Create a new proxy rule for to redirect from custom domain to another domain.
Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes.
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/appwrite/services/proxy.rb', line 125 def create_redirect_rule(domain:, url:, status_code:, resource_id:, resource_type:) api_path = '/proxy/rules/redirect' if domain.nil? raise Appwrite::Exception.new('Missing required parameter: "domain"') end if url.nil? raise Appwrite::Exception.new('Missing required parameter: "url"') end if status_code.nil? raise Appwrite::Exception.new('Missing required parameter: "statusCode"') end if resource_id.nil? raise Appwrite::Exception.new('Missing required parameter: "resourceId"') end if resource_type.nil? raise Appwrite::Exception.new('Missing required parameter: "resourceType"') end api_params = { domain: domain, url: url, statusCode: status_code, resourceId: resource_id, resourceType: resource_type, } api_headers = { "content-type": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::ProxyRule ) end |
#create_site_rule(domain:, site_id:, branch: nil) ⇒ ProxyRule
Create a new proxy rule for serving Appwrite Site on custom domain.
Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes.
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/appwrite/services/proxy.rb', line 180 def create_site_rule(domain:, site_id:, branch: nil) api_path = '/proxy/rules/site' if domain.nil? raise Appwrite::Exception.new('Missing required parameter: "domain"') end if site_id.nil? raise Appwrite::Exception.new('Missing required parameter: "siteId"') end api_params = { domain: domain, siteId: site_id, branch: branch, } api_headers = { "content-type": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::ProxyRule ) end |
#delete_rule(rule_id:) ⇒ Object
Delete a proxy rule by its unique ID.
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/appwrite/services/proxy.rb', line 245 def delete_rule(rule_id:) api_path = '/proxy/rules/{ruleId}' .gsub('{ruleId}', rule_id) if rule_id.nil? raise Appwrite::Exception.new('Missing required parameter: "ruleId"') end api_params = { } api_headers = { "content-type": 'application/json', } @client.call( method: 'DELETE', path: api_path, headers: api_headers, params: api_params, ) end |
#get_rule(rule_id:) ⇒ ProxyRule
Get a proxy rule by its unique ID.
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/appwrite/services/proxy.rb', line 216 def get_rule(rule_id:) api_path = '/proxy/rules/{ruleId}' .gsub('{ruleId}', rule_id) if rule_id.nil? raise Appwrite::Exception.new('Missing required parameter: "ruleId"') end api_params = { } api_headers = { } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::ProxyRule ) end |
#list_rules(queries: nil, total: nil) ⇒ ProxyRuleList
Get a list of all the proxy rules. You can use the query params to filter your results.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/appwrite/services/proxy.rb', line 17 def list_rules(queries: nil, total: nil) api_path = '/proxy/rules' api_params = { queries: queries, total: total, } api_headers = { } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::ProxyRuleList ) end |
#update_rule_status(rule_id:) ⇒ ProxyRule
If not succeeded yet, retry verification process of a proxy rule domain. This endpoint triggers domain verification by checking DNS records. If verification is successful, a TLS certificate will be automatically provisioned for the domain asynchronously in the background.
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
# File 'lib/appwrite/services/proxy.rb', line 277 def update_rule_status(rule_id:) api_path = '/proxy/rules/{ruleId}/status' .gsub('{ruleId}', rule_id) if rule_id.nil? raise Appwrite::Exception.new('Missing required parameter: "ruleId"') end api_params = { } api_headers = { "content-type": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::ProxyRule ) end |