Static Route module¶
rapyuta.io enables you to create a static route URL and give it a globally unique FQDN. When you add a static route, an externally exposed endpoint is essentially guaranteed to be available at the URL of that particular static route. It makes externally exposed endpoints (and hence the deployments exposing them) resilient to failure or re-deployment, facilitates maintenance and upgrades to the backend/deployment while retaining the same unique globally available URL.
Static routes are used frequently to get a deterministic URL/route for your application while exposing the network endpoint externally
Client Module¶
- class Client(auth_token, project=None)¶
Client class provides access to device, package, volume and deployment classes.
- __init__(auth_token, project=None)¶
Get new client object
- Parameters
auth_token (string) – Authentication token
project (string) – project_guid of the user
- create_static_route(name)¶
Create static route of a certain name
- Parameters
name (str) – Name of the static route. It should follow ^[a-z][a-z0-9-]*$ and should not contain black listed keyword and be of length between 4 and 64
- Returns
Instance of
StaticRoute
class.
Following example demonstrates how to create a static route.
>>> from rapyuta_io import Client >>> client = Client(auth_token='auth_token', project='project_guid') >>> static_route = client.create_static_route('example-route')
- delete_static_route(route_guid)¶
Delete static route by its guid
- Parameters
route_guid (str) – GUID string of a
StaticRoute
class.
Following example demonstrates how to delete a static route
>>> from rapyuta_io import Client >>> client = Client(auth_token='auth_token', project='project_guid') >>> static_route_guid = client.get_all_static_routes()[0]['guid'] >>> client.delete_static_route(static_route_guid)
- get_all_static_routes()¶
List all static routes in a project.
- Returns
Instances of
StaticRoute
class.
Following example demonstrates how to list all static routes
>>> from rapyuta_io import Client >>> client = Client(auth_token='auth_token', project='project_guid') >>> static_routes = client.get_all_static_routes()
- get_static_route(route_guid)¶
Get static routes by its guid
- Parameters
route_guid (str) – GUID string of a
StaticRoute
class.- Returns
Instance of
StaticRoute
class.
Following example demonstrates how to get a static route
>>> from rapyuta_io import Client >>> client = Client(auth_token='auth_token', project='project_guid') >>> static_route_guid = client.get_all_static_routes()[0]['guid'] >>> static_route = client.get_static_route(static_route_guid)
- get_static_route_by_name(name)¶
Get static routes by its name
- Parameters
name (str) – Name (urlPrefix) of the
StaticRoute
instance.- Returns
Instance of
StaticRoute
class or None if it doesn’t exist
Following example demonstrates how to get a static route by its name/url prefix
>>> from rapyuta_io import Client >>> client = Client(auth_token='auth_token', project='project_guid') >>> static_route = client.get_static_route_by_name('example-route')
Static Route Module¶
- class StaticRoute(*args, **kwargs)¶
StaticRoute class represents an instance of a static route. It contains methods to delete static route.
- Variables
CreatedAt – Date of creation
DeletedAt – Date of deletion
ID – ID of the static route
creator – User guid who created the static route
metadata – Metadata associated with the static route
projectGUID – GUID of the project the static route is to be created in
urlPrefix – Prefix/subdomain of the static route
urlString – Full static route URL
- delete()¶
Delete static route
- Returns
True or False
- Return type
Following example demonstrates how to delete a static route
>>> from rapyuta_io import Client >>> client = Client(auth_token='auth_token', project='project_guid') >>> static_route = client.get_all_static_routes()[0] >>> result = static_route.delete()