[−][src]Struct mackerel_client::client::Client
Represents an API client for Mackerel.
Implementations
impl Client
[src]
pub fn new(api_key: &str) -> Client
[src]
Creates a new API client from API key.
pub fn new_with_api_base(api_key: &str, api_base: &str) -> Client
[src]
Creates a new API client from API key and API base.
pub fn request<P, B, R, F, S>(
&self,
method: Method,
path: P,
queries: Vec<(&str, Vec<&str>)>,
body_opt: Option<B>,
converter: F
) -> Result<S> where
P: AsRef<str>,
B: Serialize,
R: Deserialize<'de>,
F: FnOnce(R) -> S,
[src]
&self,
method: Method,
path: P,
queries: Vec<(&str, Vec<&str>)>,
body_opt: Option<B>,
converter: F
) -> Result<S> where
P: AsRef<str>,
B: Serialize,
R: Deserialize<'de>,
F: FnOnce(R) -> S,
Sends a request to the API.
The entire response body is deserialized as R
, converted by converter
and returns S
.
impl Client
[src]
pub fn list_alerts(&self) -> Result<Vec<Alert>>
[src]
Fetches all the open alerts.
See https://mackerel.io/api-docs/entry/alerts#get.
pub fn close_alert(&self, alert_id: String, reason: &str) -> Result<Alert>
[src]
Closes the specified alert.
See https://mackerel.io/api-docs/entry/alerts#close.
impl Client
[src]
pub fn list_channels(&self) -> Result<Vec<Channel>>
[src]
Fetches all the channels.
See https://mackerel.io/api-docs/entry/channels#get.
impl Client
[src]
pub fn list_dashboards(&self) -> Result<Vec<Dashboard>>
[src]
Fetches all the dashboards.
See https://mackerel.io/api-docs/entry/dashboards#list.
pub fn create_dashboard(&self, dashboard: Dashboard) -> Result<Dashboard>
[src]
Creates a new dashboard.
See https://mackerel.io/api-docs/entry/dashboards#create.
pub fn get_dashboard(&self, dashboard_id: String) -> Result<Dashboard>
[src]
Gets a dashboard.
See https://mackerel.io/api-docs/entry/dashboards#get.
pub fn update_dashboard(&self, dashboard: Dashboard) -> Result<Dashboard>
[src]
Updates a dashboard.
See https://mackerel.io/api-docs/entry/dashboards#update.
pub fn delete_dashboard(&self, dashboard_id: String) -> Result<Dashboard>
[src]
Deletes a dashboard.
See https://mackerel.io/api-docs/entry/dashboards#delete.
impl Client
[src]
pub fn list_graph_annotations(
&self,
service: &str,
from: u64,
to: u64
) -> Result<Vec<GraphAnnotation>>
[src]
&self,
service: &str,
from: u64,
to: u64
) -> Result<Vec<GraphAnnotation>>
Fetches graph annotations.
See https://mackerel.io/api-docs/entry/graph-annotations#get.
pub fn create_graph_annotation(
&self,
graph_annotation: GraphAnnotation
) -> Result<GraphAnnotation>
[src]
&self,
graph_annotation: GraphAnnotation
) -> Result<GraphAnnotation>
Creates a new graph annotation.
See https://mackerel.io/api-docs/entry/graph-annotations#create.
pub fn update_graph_annotation(
&self,
graph_annotation: GraphAnnotation
) -> Result<GraphAnnotation>
[src]
&self,
graph_annotation: GraphAnnotation
) -> Result<GraphAnnotation>
Updates a graph annotation.
See https://mackerel.io/api-docs/entry/graph-annotations#update.
pub fn delete_graph_annotation(
&self,
graph_annotation_id: String
) -> Result<GraphAnnotation>
[src]
&self,
graph_annotation_id: String
) -> Result<GraphAnnotation>
Deletes a graph annotation.
See https://mackerel.io/api-docs/entry/graph-annotations#delete.
impl Client
[src]
pub fn create_host(&self, param: CreateHostParam) -> Result<String>
[src]
Creates a new host.
See https://mackerel.io/api-docs/entry/hosts#create.
impl Client
[src]
pub fn create_invitation(&self, invitation: Invitation) -> Result<Invitation>
[src]
Creates a new invitation.
See https://mackerel.io/api-docs/entry/invitations#create.
pub fn revoke_invitation(&self, email: &str) -> Result<()>
[src]
Revokes an invitation.
See https://mackerel.io/api-docs/entry/invitations#revoke.
impl Client
[src]
pub fn get_metadata(&self, host_id: &str, namespace: &str) -> Result<Value>
[src]
Retrieves a host metadata.
See https://mackerel.io/api-docs/entry/metadata#get.
pub fn put_metadata(
&self,
host_id: &str,
namespace: &str,
metadata: Value
) -> Result<()>
[src]
&self,
host_id: &str,
namespace: &str,
metadata: Value
) -> Result<()>
Creates/Updatates a host metadata.
See https://mackerel.io/api-docs/entry/metadata#put.
pub fn delete_metadata(&self, host_id: &str, namespace: &str) -> Result<()>
[src]
Deletes a host metadata.
See https://mackerel.io/api-docs/entry/metadata#delete.
pub fn list_metadata(&self, host_id: &str) -> Result<Vec<Metadata>>
[src]
Lists host metadata.
See https://mackerel.io/api-docs/entry/metadata#list.
impl Client
[src]
pub fn list_monitors(&self) -> Result<Vec<Monitor>>
[src]
Fetches all the monitors.
See https://mackerel.io/api-docs/entry/monitors#get.
pub fn create_monitor(&self, monitor: Monitor) -> Result<Monitor>
[src]
Registers a new monitor.
See https://mackerel.io/api-docs/entry/monitors#create.
pub fn update_monitor(&self, monitor: Monitor) -> Result<Monitor>
[src]
Updates a monitor.
See https://mackerel.io/api-docs/entry/monitors#update.
pub fn delete_monitor(&self, monitor_id: String) -> Result<Monitor>
[src]
Deletes a monitor.
See https://mackerel.io/api-docs/entry/monitors#delete.
impl Client
[src]
pub fn get_organization(&self) -> Result<Organization>
[src]
Retrieve the information on the organization.
See https://mackerel.io/api-docs/entry/organizations#get.
impl Client
[src]
pub fn list_roles(&self, service_name: String) -> Result<Vec<Role>>
[src]
Fetches the roles in the specified service.
See https://mackerel.io/api-docs/entry/services#rolelist.
pub fn create_role(&self, service_name: String, role: Role) -> Result<Role>
[src]
Creates a new role.
See https://mackerel.io/api-docs/entry/services#rolecreate.
pub fn delete_role(
&self,
service_name: String,
role_name: String
) -> Result<Role>
[src]
&self,
service_name: String,
role_name: String
) -> Result<Role>
Deletes a role.
See https://mackerel.io/api-docs/entry/services#roledelete.
impl Client
[src]
pub fn list_services(&self) -> Result<Vec<Service>>
[src]
Fetches all the services.
See https://mackerel.io/api-docs/entry/services#list.
pub fn create_service(&self, service: Service) -> Result<Service>
[src]
Creates a new service.
See https://mackerel.io/api-docs/entry/services#create.
pub fn delete_service(&self, service_name: String) -> Result<Service>
[src]
Deletes a service.
See https://mackerel.io/api-docs/entry/services#delete.
pub fn list_service_metric_names(
&self,
service_name: String
) -> Result<Vec<String>>
[src]
&self,
service_name: String
) -> Result<Vec<String>>
Fetches the names of the service metrics.
See https://mackerel.io/api-docs/entry/services#metric-names.
impl Client
[src]
pub fn list_users(&self) -> Result<Vec<User>>
[src]
Fetches all the services.
See https://mackerel.io/api-docs/entry/users#list.
pub fn delete_user(&self, user_name: &str) -> Result<User>
[src]
Delete the user from the organization.
See https://mackerel.io/api-docs/entry/users#delete.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnwindSafe for Client
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,