Skip to main content

Client

Struct Client 

Source
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

Source

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.

Source

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

Source

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; use runtime instead)
  • environment_id: Filter for resources that belong to an environment
  • include_previews: Include previews in the response
  • limit: The maximum number of items to return. For details, see Pagination.
  • name: Filter by name
  • owner_id: The ID of the workspaces to return resources for
  • region: Filter by resource region
  • suspended: Filter resources based on whether they’re suspended or not suspended
  • type_: Filter for types of services
  • updated_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)
Source

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

Source

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 environment
  • include_replicas: Include replicas in the response
  • limit: The maximum number of items to return. For details, see Pagination.
  • name: Filter by name
  • owner_id: The ID of the workspaces to return resources for
  • region: Filter by resource region
  • suspended: Filter resources based on whether they’re suspended or not suspended
  • updated_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)
Source

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

Source

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

Source

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 service
  • cursor: 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.
Source

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 service
  • body
Source

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 service
  • cursor: 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 route
  • limit: The maximum number of items to return. For details, see Pagination.
  • source: Filter for the source path of the route
  • type_: Filter for the type of route rule
Source

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 service
  • body
Source

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 service
  • body
Source

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 service
  • body
Source

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 service
  • created_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 statuses
  • updated_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)
Source

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 service
  • body
Source

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 service
  • deploy_id: The ID of the deploy
Source

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 to now().

  • 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 to now() - 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 include app for application logs, request for request logs, and build for build logs. You can find the full set of types available for a query by using the GET /logs/values endpoint.

Trait Implementations§

Source§

impl ClientHooks for &Client

Source§

async fn pre<E>( &self, request: &mut Request, info: &OperationInfo, ) -> Result<(), Error<E>>

Runs prior to the execution of the request. This may be used to modify the request before it is transmitted.
Source§

async fn post<E>( &self, result: &Result<Response, Error>, info: &OperationInfo, ) -> Result<(), Error<E>>

Runs after completion of the request.
Source§

async fn exec( &self, request: Request, info: &OperationInfo, ) -> Result<Response, Error>

Execute the request. Note that for almost any reasonable implementation this will include code equivalent to this: Read more
Source§

impl ClientInfo<()> for Client

Source§

fn api_version() -> &'static str

Get the version of this API. Read more
Source§

fn baseurl(&self) -> &str

Get the base URL to which requests are made.
Source§

fn client(&self) -> &Client

Get the internal reqwest::Client used to make requests.
Source§

fn inner(&self) -> &()

Get the inner value of type T if one is specified.
Source§

impl Clone for Client

Source§

fn clone(&self) -> Client

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Client

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more