pub struct ApiKeys {
    pub client: Client,
}

Fields§

§client: Client

Implementations§

source§

impl ApiKeys

source

pub async fn get( &self, limit: i64 ) -> Result<Response<GetApiKeysResponse>, ClientError>

Retrieve all API Keys belonging to the authenticated user.

This function performs a GET to the /api_keys endpoint.

This endpoint allows you to retrieve all API Keys that belong to the authenticated user.

A successful response from this API will include all available API keys’ names and IDs.

For security reasons, there is not a way to retrieve the key itself after it’s created. If you lose your API key, you must create a new one. Only the “Create API keys” endpoint will return a key to you and only at the time of creation.

An api_key_id can be used to update or delete the key, as well as retrieve the key’s details, such as its scopes.

Parameters:

  • limit: i64
  • on_behalf_of: &str – The license key provided with your New Relic account.
source

pub async fn create( &self, body: &CreateApiKeysRequest ) -> Result<Response<CreateApiKeysResponse>, ClientError>

Create API keys.

This function performs a POST to the /api_keys endpoint.

This endpoint allows you to create a new API Key for the user.

To create your initial SendGrid API Key, you should use the SendGrid App. Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management.

There is a limit of 100 API Keys on your account.

A JSON request body containing a name property is required when making requests to this endpoint. If the number of maximum keys, 100, is reached, a 403 status will be returned.

Though the name field is required, it does not need to be unique. A unique API key ID will be generated for each key you create and returned in the response body.

It is not necessary to pass a scopes field to the API when creating a key, but you should be aware that omitting the scopes field from your request will create a key with “Full Access” permissions by default.

See the API Key Permissions List for all available scopes. An API key’s scopes can be updated after creation using the “Update API keys” endpoint.

Parameters:

  • on_behalf_of: &str – The license key provided with your New Relic account.
source

pub async fn get_key( &self, api_key_id: &str ) -> Result<Response<GetApiKeysKeyResponse>, ClientError>

Retrieve an existing API Key.

This function performs a GET to the /api_keys/{api_key_id} endpoint.

This endpoint allows you to retrieve a single API key using an api_key_id.

The endpoint will return a key’s name, ID, and scopes. If the API Key ID does not, exist a 404 status will be returned.

See the API Key Permissions List for all available scopes. An API key’s scopes can be updated after creation using the “Update API keys” endpoint.

Parameters:

  • on_behalf_of: &str – The license key provided with your New Relic account.
source

pub async fn put_key( &self, api_key_id: &str, body: &PutApiKeysKeyRequest ) -> Result<Response<ApiKeyNameScopesAllOf>, ClientError>

Update API key name and scopes.

This function performs a PUT to the /api_keys/{api_key_id} endpoint.

This endpoint allows you to update the name and scopes of a given API key.

You must pass this endpoint a JSON request body with a name field and a scopes array containing at least one scope. The name and scopes fields will be used to update the key associated with the api_key_id in the request URL.

If you need to update a key’s scopes only, pass the name field with the key’s existing name; the name will not be modified. If you need to update a key’s name only, use the “Update API key name” endpoint.

See the API Key Permissions List for all available scopes.

Parameters:

  • on_behalf_of: &str – The license key provided with your New Relic account.
source

pub async fn delete_key( &self, api_key_id: &str ) -> Result<Response<()>, ClientError>

Delete API keys.

This function performs a DELETE to the /api_keys/{api_key_id} endpoint.

This endpoint allows you to revoke an existing API Key using an api_key_id

Authentications using a revoked API Key will fail after after some small propogation delay. If the API Key ID does not exist, a 404 status will be returned.

Parameters:

  • on_behalf_of: &str – The license key provided with your New Relic account.
source

pub async fn patch_key( &self, api_key_id: &str, body: &IpPool ) -> Result<Response<ApiKeyNameId>, ClientError>

Update API key name.

This function performs a PATCH to the /api_keys/{api_key_id} endpoint.

This endpoint allows you to update the name of an existing API Key.

You must pass this endpoint a JSON request body with a name property, which will be used to rename the key associated with the api_key_id passed in the URL.

Parameters:

  • on_behalf_of: &str – The license key provided with your New Relic account.

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

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