pub struct Client { /* private fields */ }Expand description
Client for Render Public API
Manage everything about your Render services
Version: 1.0.0
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(baseurl: &str) -> Self
pub fn new(baseurl: &str) -> Self
Create a new client.
baseurl is the base URL provided to the internal
reqwest::Client, and should include a scheme and hostname,
as well as port and a path stem if applicable.
Sourcepub fn new_with_client(baseurl: &str, client: Client) -> Self
pub fn new_with_client(baseurl: &str, client: Client) -> Self
Construct a new client with an existing reqwest::Client,
allowing more control over its configuration.
baseurl is the base URL provided to the internal
reqwest::Client, and should include a scheme and hostname,
as well as port and a path stem if applicable.
Source§impl Client
impl Client
Sourcepub async fn list_services<'a>(
&'a self,
created_after: Option<&'a DateTime<Utc>>,
created_before: Option<&'a DateTime<Utc>>,
cursor: Option<&'a str>,
env: Option<&'a Vec<ServiceRuntime>>,
environment_id: Option<&'a Vec<String>>,
include_previews: Option<bool>,
limit: Option<NonZeroU64>,
name: Option<&'a Vec<String>>,
owner_id: Option<&'a Vec<String>>,
region: Option<&'a Vec<Region>>,
suspended: Option<&'a Vec<String>>,
type_: Option<&'a Vec<ServiceType>>,
updated_after: Option<&'a DateTime<Utc>>,
updated_before: Option<&'a DateTime<Utc>>,
) -> Result<ResponseValue<ServiceList>, Error<Error>>
pub async fn list_services<'a>( &'a self, created_after: Option<&'a DateTime<Utc>>, created_before: Option<&'a DateTime<Utc>>, cursor: Option<&'a str>, env: Option<&'a Vec<ServiceRuntime>>, environment_id: Option<&'a Vec<String>>, include_previews: Option<bool>, limit: Option<NonZeroU64>, name: Option<&'a Vec<String>>, owner_id: Option<&'a Vec<String>>, region: Option<&'a Vec<Region>>, suspended: Option<&'a Vec<String>>, type_: Option<&'a Vec<ServiceType>>, updated_after: Option<&'a DateTime<Utc>>, updated_before: Option<&'a DateTime<Utc>>, ) -> Result<ResponseValue<ServiceList>, Error<Error>>
List services
List services matching the provided filters. If no filters are provided, returns all services you have permissions to view.
Sends a GET request to /services
Arguments:
created_after: Filter for resources created after a certain time (specified as an ISO 8601 timestamp)created_before: Filter for resources created before a certain time (specified as an ISO 8601 timestamp)cursor: The position in the result list to start from when fetching paginated results. For details, see Pagination.env: Filter for environments (runtimes) of services (deprecated; useruntimeinstead)environment_id: Filter for resources that belong to an environmentinclude_previews: Include previews in the responselimit: The maximum number of items to return. For details, see Pagination.name: Filter by nameowner_id: The ID of the workspaces to return resources forregion: Filter by resource regionsuspended: Filter resources based on whether they’re suspended or not suspendedtype_: Filter for types of servicesupdated_after: Filter for resources updated after a certain time (specified as an ISO 8601 timestamp)updated_before: Filter for resources updated before a certain time (specified as an ISO 8601 timestamp)
Sourcepub async fn create_service<'a>(
&'a self,
body: &'a ServicePost,
) -> Result<ResponseValue<ServiceAndDeploy>, Error<Error>>
pub async fn create_service<'a>( &'a self, body: &'a ServicePost, ) -> Result<ResponseValue<ServiceAndDeploy>, Error<Error>>
Create service
Creates a new Render service in the specified workspace with the specified configuration.
Sends a POST request to /services
Sourcepub async fn list_postgres<'a>(
&'a self,
created_after: Option<&'a DateTime<Utc>>,
created_before: Option<&'a DateTime<Utc>>,
cursor: Option<&'a str>,
environment_id: Option<&'a Vec<String>>,
include_replicas: Option<bool>,
limit: Option<NonZeroU64>,
name: Option<&'a Vec<String>>,
owner_id: Option<&'a Vec<String>>,
region: Option<&'a Vec<Region>>,
suspended: Option<&'a Vec<String>>,
updated_after: Option<&'a DateTime<Utc>>,
updated_before: Option<&'a DateTime<Utc>>,
) -> Result<ResponseValue<Vec<PostgresWithCursor>>, Error<Error>>
pub async fn list_postgres<'a>( &'a self, created_after: Option<&'a DateTime<Utc>>, created_before: Option<&'a DateTime<Utc>>, cursor: Option<&'a str>, environment_id: Option<&'a Vec<String>>, include_replicas: Option<bool>, limit: Option<NonZeroU64>, name: Option<&'a Vec<String>>, owner_id: Option<&'a Vec<String>>, region: Option<&'a Vec<Region>>, suspended: Option<&'a Vec<String>>, updated_after: Option<&'a DateTime<Utc>>, updated_before: Option<&'a DateTime<Utc>>, ) -> Result<ResponseValue<Vec<PostgresWithCursor>>, Error<Error>>
List Postgres instances
List Postgres instances matching the provided filters. If no filters are provided, all Postgres instances are returned.
Sends a GET request to /postgres
Arguments:
created_after: Filter for resources created after a certain time (specified as an ISO 8601 timestamp)created_before: Filter for resources created before a certain time (specified as an ISO 8601 timestamp)cursor: The position in the result list to start from when fetching paginated results. For details, see Pagination.environment_id: Filter for resources that belong to an environmentinclude_replicas: Include replicas in the responselimit: The maximum number of items to return. For details, see Pagination.name: Filter by nameowner_id: The ID of the workspaces to return resources forregion: Filter by resource regionsuspended: Filter resources based on whether they’re suspended or not suspendedupdated_after: Filter for resources updated after a certain time (specified as an ISO 8601 timestamp)updated_before: Filter for resources updated before a certain time (specified as an ISO 8601 timestamp)
Sourcepub async fn create_postgres<'a>(
&'a self,
body: &'a PostgresPostInput,
) -> Result<ResponseValue<PostgresDetail>, Error<Error>>
pub async fn create_postgres<'a>( &'a self, body: &'a PostgresPostInput, ) -> Result<ResponseValue<PostgresDetail>, Error<Error>>
Create Postgres instance
Create a new Postgres instance.
Sends a POST request to /postgres
Sourcepub async fn retrieve_postgres_connection_info<'a>(
&'a self,
postgres_id: &'a str,
) -> Result<ResponseValue<PostgresConnectionInfo>, Error<Error>>
pub async fn retrieve_postgres_connection_info<'a>( &'a self, postgres_id: &'a str, ) -> Result<ResponseValue<PostgresConnectionInfo>, Error<Error>>
Retrieve Postgres connection info
Retrieve connection info for a Postgres instance by ID. Connection info includes sensitive information.
Sends a GET request to /postgres/{postgresId}/connection-info
Sourcepub async fn get_env_vars_for_service<'a>(
&'a self,
service_id: &'a str,
cursor: Option<&'a str>,
limit: Option<NonZeroU64>,
) -> Result<ResponseValue<Vec<EnvVarWithCursor>>, Error<Error>>
pub async fn get_env_vars_for_service<'a>( &'a self, service_id: &'a str, cursor: Option<&'a str>, limit: Option<NonZeroU64>, ) -> Result<ResponseValue<Vec<EnvVarWithCursor>>, Error<Error>>
List environment variables
List all environment variables for the service with the provided ID.
Sends a GET request to /services/{serviceId}/env-vars
Arguments:
service_id: The ID of the servicecursor: The position in the result list to start from when fetching paginated results. For details, see Pagination.limit: The maximum number of items to return. For details, see Pagination.
Sourcepub async fn update_env_vars_for_service<'a>(
&'a self,
service_id: &'a str,
body: &'a Vec<UpdateEnvVarsForServiceBodyItem>,
) -> Result<ResponseValue<Vec<EnvVarWithCursor>>, Error<Error>>
pub async fn update_env_vars_for_service<'a>( &'a self, service_id: &'a str, body: &'a Vec<UpdateEnvVarsForServiceBodyItem>, ) -> Result<ResponseValue<Vec<EnvVarWithCursor>>, Error<Error>>
Update environment variables
Replace all environment variables for a service with the provided list of environment variables.
Sends a PUT request to /services/{serviceId}/env-vars
Arguments:
service_id: The ID of the servicebody
Sourcepub async fn list_routes<'a>(
&'a self,
service_id: &'a str,
cursor: Option<&'a str>,
destination: Option<&'a Vec<String>>,
limit: Option<NonZeroU64>,
source: Option<&'a Vec<String>>,
type_: Option<&'a Vec<String>>,
) -> Result<ResponseValue<Vec<RouteWithCursor>>, Error<Error>>
pub async fn list_routes<'a>( &'a self, service_id: &'a str, cursor: Option<&'a str>, destination: Option<&'a Vec<String>>, limit: Option<NonZeroU64>, source: Option<&'a Vec<String>>, type_: Option<&'a Vec<String>>, ) -> Result<ResponseValue<Vec<RouteWithCursor>>, Error<Error>>
List redirect/rewrite rules
List a particular service’s redirect/rewrite rules that match the provided filters. If no filters are provided, all rules for the service are returned.
Sends a GET request to /services/{serviceId}/routes
Arguments:
service_id: The ID of the servicecursor: The position in the result list to start from when fetching paginated results. For details, see Pagination.destination: Filter for the destination path of the routelimit: The maximum number of items to return. For details, see Pagination.source: Filter for the source path of the routetype_: Filter for the type of route rule
Sourcepub async fn put_routes<'a>(
&'a self,
service_id: &'a str,
body: &'a Vec<RoutePut>,
) -> Result<ResponseValue<Vec<Route>>, Error<Error>>
pub async fn put_routes<'a>( &'a self, service_id: &'a str, body: &'a Vec<RoutePut>, ) -> Result<ResponseValue<Vec<Route>>, Error<Error>>
Update redirect/rewrite rules
Replace all redirect/rewrite rules for a particular service with the provided list.
This deletes all existing redirect/rewrite rules for the service that aren’t included in the request.
Rule priority is assigned according to list order (the first rule in the list has the highest priority).
Sends a PUT request to /services/{serviceId}/routes
Arguments:
service_id: The ID of the servicebody
Sourcepub async fn add_route<'a>(
&'a self,
service_id: &'a str,
body: &'a RoutePost,
) -> Result<ResponseValue<Route>, Error<Error>>
pub async fn add_route<'a>( &'a self, service_id: &'a str, body: &'a RoutePost, ) -> Result<ResponseValue<Route>, Error<Error>>
Add redirect/rewrite rules
Add redirect/rewrite rules to the service with the provided ID.
Sends a POST request to /services/{serviceId}/routes
Arguments:
service_id: The ID of the servicebody
Sourcepub async fn patch_route<'a>(
&'a self,
service_id: &'a str,
body: &'a RoutePatch,
) -> Result<ResponseValue<PatchRouteResponse>, Error<Error>>
pub async fn patch_route<'a>( &'a self, service_id: &'a str, body: &'a RoutePatch, ) -> Result<ResponseValue<PatchRouteResponse>, Error<Error>>
Update redirect/rewrite rule priority
Update the priority for a particular redirect/rewrite rule.
To apply redirect/rewrite rules to an incoming request, Render starts
from the rule with priority 0 and applies the first encountered rule
that matches the request’s path (if any).
Render increments the priority of other rules by 1 as necessary to
make space for the updated rule.
Sends a PATCH request to /services/{serviceId}/routes
Arguments:
service_id: The ID of the servicebody
Sourcepub async fn list_deploys<'a>(
&'a self,
service_id: &'a str,
created_after: Option<&'a DateTime<Utc>>,
created_before: Option<&'a DateTime<Utc>>,
cursor: Option<&'a str>,
finished_after: Option<&'a DateTime<Utc>>,
finished_before: Option<&'a DateTime<Utc>>,
limit: Option<NonZeroU64>,
status: Option<&'a Vec<DeployStatus>>,
updated_after: Option<&'a DateTime<Utc>>,
updated_before: Option<&'a DateTime<Utc>>,
) -> Result<ResponseValue<DeployList>, Error<Error>>
pub async fn list_deploys<'a>( &'a self, service_id: &'a str, created_after: Option<&'a DateTime<Utc>>, created_before: Option<&'a DateTime<Utc>>, cursor: Option<&'a str>, finished_after: Option<&'a DateTime<Utc>>, finished_before: Option<&'a DateTime<Utc>>, limit: Option<NonZeroU64>, status: Option<&'a Vec<DeployStatus>>, updated_after: Option<&'a DateTime<Utc>>, updated_before: Option<&'a DateTime<Utc>>, ) -> Result<ResponseValue<DeployList>, Error<Error>>
List deploys
List deploys matching the provided filters. If no filters are provided, all deploys for the service are returned.
Sends a GET request to /services/{serviceId}/deploys
Arguments:
service_id: The ID of the servicecreated_after: Filter for deploys created after a certain time (specified as an ISO 8601 timestamp)created_before: Filter for deploys created before a certain time (specified as an ISO 8601 timestamp)cursor: The position in the result list to start from when fetching paginated results. For details, see Pagination.finished_after: Filter for deploys finished after a certain time (specified as an ISO 8601 timestamp)finished_before: Filter for deploys finished before a certain time (specified as an ISO 8601 timestamp)limit: The maximum number of items to return. For details, see Pagination.status: Filter for deploys with the specified statusesupdated_after: Filter for deploys updated after a certain time (specified as an ISO 8601 timestamp)updated_before: Filter for deploys updated before a certain time (specified as an ISO 8601 timestamp)
Sourcepub async fn create_deploy<'a>(
&'a self,
service_id: &'a str,
body: &'a CreateDeployBody,
) -> Result<ResponseValue<()>, Error<Error>>
pub async fn create_deploy<'a>( &'a self, service_id: &'a str, body: &'a CreateDeployBody, ) -> Result<ResponseValue<()>, Error<Error>>
Trigger deploy
Trigger a deploy for the service with the provided ID.
Sends a POST request to /services/{serviceId}/deploys
Arguments:
service_id: The ID of the servicebody
Sourcepub async fn retrieve_deploy<'a>(
&'a self,
service_id: &'a str,
deploy_id: &'a str,
) -> Result<ResponseValue<Deploy>, Error<Error>>
pub async fn retrieve_deploy<'a>( &'a self, service_id: &'a str, deploy_id: &'a str, ) -> Result<ResponseValue<Deploy>, Error<Error>>
Retrieve deploy
Retrieve the details of a particular deploy for a particular service.
Sends a GET request to /services/{serviceId}/deploys/{deployId}
Arguments:
service_id: The ID of the servicedeploy_id: The ID of the deploy
Sourcepub async fn list_logs<'a>(
&'a self,
direction: Option<&'a str>,
end_time: Option<&'a DateTime<Utc>>,
host: Option<&'a Vec<String>>,
instance: Option<&'a Vec<String>>,
level: Option<&'a Vec<String>>,
limit: Option<NonZeroU64>,
method: Option<&'a Vec<String>>,
owner_id: &'a str,
path: Option<&'a Vec<String>>,
resource: &'a Vec<String>,
start_time: Option<&'a DateTime<Utc>>,
status_code: Option<&'a Vec<String>>,
task: Option<&'a Vec<String>>,
task_run: Option<&'a Vec<String>>,
text: Option<&'a Vec<String>>,
type_: Option<&'a Vec<String>>,
) -> Result<ResponseValue<ListLogsResponse>, Error<Error>>
pub async fn list_logs<'a>( &'a self, direction: Option<&'a str>, end_time: Option<&'a DateTime<Utc>>, host: Option<&'a Vec<String>>, instance: Option<&'a Vec<String>>, level: Option<&'a Vec<String>>, limit: Option<NonZeroU64>, method: Option<&'a Vec<String>>, owner_id: &'a str, path: Option<&'a Vec<String>>, resource: &'a Vec<String>, start_time: Option<&'a DateTime<Utc>>, status_code: Option<&'a Vec<String>>, task: Option<&'a Vec<String>>, task_run: Option<&'a Vec<String>>, text: Option<&'a Vec<String>>, type_: Option<&'a Vec<String>>, ) -> Result<ResponseValue<ListLogsResponse>, Error<Error>>
List logs
List logs matching the provided filters. Logs are paginated by start and
end timestamps. There are more logs to fetch if hasMore is true in
the response. Provide the nextStartTime and nextEndTime
timestamps as the startTime and endTime query parameters to fetch
the next page of logs.
You can query for logs across multiple resources, but all resources must be in the same region and belong to the same owner.
Sends a GET request to /logs
Arguments:
-
direction: The direction to query logs for. Backward will return most recent logs first. Forward will start with the oldest logs in the time range. -
end_time: Epoch/Unix timestamp of end of time range to return. Defaults tonow(). -
host: Filter request logs by their host. Wildcards and regex are supported. -
instance: Filter logs by the instance they were emitted from. An instance is the id of a specific running server. -
level: Filter logs by their severity level. Wildcards and regex are supported. -
limit: The maximum number of items to return. For details, see Pagination. -
method: Filter request logs by their requests method. Wildcards and regex are supported. -
owner_id: The ID of the workspace to return logs for -
path: Filter request logs by their path. Wildcards and regex are supported. -
resource: Filter logs by their resource. A resource is the id of a server, cronjob, job, postgres, redis, or workflow. -
start_time: Epoch/Unix timestamp of start of time range to return. Defaults tonow() - 1 hour. -
status_code: Filter request logs by their status code. Wildcards and regex are supported. -
task: Filter logs by their task(s) -
task_run: Filter logs by their task run id(s) -
text: Filter by the text of the logs. Wildcards and regex are supported. -
type_: Filter logs by their type. Types includeappfor application logs,requestfor request logs, andbuildfor build logs. You can find the full set of types available for a query by using theGET /logs/valuesendpoint.