Expand description
Client to a server supporting the InfluxData 2.0 API.
Fields
url: String
The base URL this client sends requests to
org: String
The organization tied to this client
Implementations
sourceimpl Client
impl Client
sourcepub async fn create_bucket(
&self,
post_bucket_request: Option<PostBucketRequest>
) -> Result<(), RequestError>
pub async fn create_bucket(
&self,
post_bucket_request: Option<PostBucketRequest>
) -> Result<(), RequestError>
Create a new bucket in the organization specified by the 16-digit
hexadecimal org_id
and with the bucket name bucket
.
sourceimpl Client
impl Client
sourcepub async fn delete(
&self,
bucket: &str,
start: NaiveDateTime,
stop: NaiveDateTime,
predicate: Option<String>
) -> Result<(), RequestError>
pub async fn delete(
&self,
bucket: &str,
start: NaiveDateTime,
stop: NaiveDateTime,
predicate: Option<String>
) -> Result<(), RequestError>
Delete data points from a bucket matching specified parameters.
sourceimpl Client
impl Client
sourcepub async fn health(&self) -> Result<HealthCheck, RequestError>
pub async fn health(&self) -> Result<HealthCheck, RequestError>
Get health of an instance
sourceimpl Client
impl Client
sourcepub async fn labels(&self) -> Result<LabelsResponse, RequestError>
pub async fn labels(&self) -> Result<LabelsResponse, RequestError>
List all Labels
sourcepub async fn labels_by_org(
&self,
org_id: &str
) -> Result<LabelsResponse, RequestError>
pub async fn labels_by_org(
&self,
org_id: &str
) -> Result<LabelsResponse, RequestError>
List all Labels by organization ID
sourcepub async fn find_label(
&self,
label_id: &str
) -> Result<LabelResponse, RequestError>
pub async fn find_label(
&self,
label_id: &str
) -> Result<LabelResponse, RequestError>
Retrieve a label by ID
sourcepub async fn create_label(
&self,
org_id: &str,
name: &str,
properties: Option<HashMap<String, String>>
) -> Result<LabelResponse, RequestError>
pub async fn create_label(
&self,
org_id: &str,
name: &str,
properties: Option<HashMap<String, String>>
) -> Result<LabelResponse, RequestError>
Create a Label
sourcepub async fn update_label(
&self,
name: Option<String>,
properties: Option<HashMap<String, String>>,
label_id: &str
) -> Result<LabelResponse, RequestError>
pub async fn update_label(
&self,
name: Option<String>,
properties: Option<HashMap<String, String>>,
label_id: &str
) -> Result<LabelResponse, RequestError>
Update a Label
sourcepub async fn delete_label(&self, label_id: &str) -> Result<(), RequestError>
pub async fn delete_label(&self, label_id: &str) -> Result<(), RequestError>
Delete a Label
sourceimpl Client
impl Client
sourcepub async fn list_organizations(
&self,
request: ListOrganizationRequest
) -> Result<Organizations, RequestError>
pub async fn list_organizations(
&self,
request: ListOrganizationRequest
) -> Result<Organizations, RequestError>
List all organizations.
sourceimpl Client
impl Client
sourcepub async fn query_suggestions(&self) -> Result<FluxSuggestions, RequestError>
pub async fn query_suggestions(&self) -> Result<FluxSuggestions, RequestError>
Get Query Suggestions
sourcepub async fn query_suggestions_name(
&self,
name: &str
) -> Result<FluxSuggestion, RequestError>
pub async fn query_suggestions_name(
&self,
name: &str
) -> Result<FluxSuggestion, RequestError>
Query Suggestions with name
sourcepub async fn query<T: FromMap>(
&self,
query: Option<Query>
) -> Result<Vec<T>, RequestError>
pub async fn query<T: FromMap>(
&self,
query: Option<Query>
) -> Result<Vec<T>, RequestError>
Query
sourcepub async fn query_analyze(
&self,
query: Option<Query>
) -> Result<AnalyzeQueryResponse, RequestError>
pub async fn query_analyze(
&self,
query: Option<Query>
) -> Result<AnalyzeQueryResponse, RequestError>
Analyze Query
sourcepub async fn query_ast(
&self,
language_request: Option<LanguageRequest>
) -> Result<AstResponse, RequestError>
pub async fn query_ast(
&self,
language_request: Option<LanguageRequest>
) -> Result<AstResponse, RequestError>
Get Query AST Repsonse
sourceimpl Client
impl Client
sourcepub async fn ready(&self) -> Result<bool, RequestError>
pub async fn ready(&self) -> Result<bool, RequestError>
Get the readiness of an instance at startup
sourceimpl Client
impl Client
sourcepub async fn is_onboarding_allowed(&self) -> Result<bool, RequestError>
pub async fn is_onboarding_allowed(&self) -> Result<bool, RequestError>
Check if database has default user, org, bucket
sourcepub async fn onboarding(
&self,
username: &str,
org: &str,
bucket: &str,
password: Option<String>,
retention_period_hrs: Option<i32>,
retention_period_seconds: Option<i32>
) -> Result<OnboardingResponse, RequestError>
pub async fn onboarding(
&self,
username: &str,
org: &str,
bucket: &str,
password: Option<String>,
retention_period_hrs: Option<i32>,
retention_period_seconds: Option<i32>
) -> Result<OnboardingResponse, RequestError>
Set up initial user, org and bucket
sourcepub async fn post_setup_user(
&self,
username: &str,
org: &str,
bucket: &str,
password: Option<String>,
retention_period_hrs: Option<i32>,
retention_period_seconds: Option<i32>
) -> Result<OnboardingResponse, RequestError>
pub async fn post_setup_user(
&self,
username: &str,
org: &str,
bucket: &str,
password: Option<String>,
retention_period_hrs: Option<i32>,
retention_period_seconds: Option<i32>
) -> Result<OnboardingResponse, RequestError>
Set up a new user, org and bucket
sourceimpl Client
impl Client
sourcepub async fn list_tasks(
&self,
request: ListTasksRequest
) -> Result<Tasks, RequestError>
pub async fn list_tasks(
&self,
request: ListTasksRequest
) -> Result<Tasks, RequestError>
List all tasks.
sourcepub async fn create_task(
&self,
request: CreateTaskRequest
) -> Result<(), RequestError>
pub async fn create_task(
&self,
request: CreateTaskRequest
) -> Result<(), RequestError>
Create a new task.
sourcepub async fn delete_task(&self, task_id: &str) -> Result<(), RequestError>
pub async fn delete_task(&self, task_id: &str) -> Result<(), RequestError>
Delete a task specified by task_id.
sourceimpl Client
impl Client
sourcepub async fn write_line_protocol(
&self,
org: &str,
bucket: &str,
body: impl Into<Body> + Send
) -> Result<(), RequestError>
pub async fn write_line_protocol(
&self,
org: &str,
bucket: &str,
body: impl Into<Body> + Send
) -> Result<(), RequestError>
Write line protocol data to the specified organization and bucket.
sourcepub async fn write(
&self,
bucket: &str,
body: impl Stream<Item = impl WriteDataPoint> + Send + Sync + 'static
) -> Result<(), RequestError>
pub async fn write(
&self,
bucket: &str,
body: impl Stream<Item = impl WriteDataPoint> + Send + Sync + 'static
) -> Result<(), RequestError>
Write a Stream
of DataPoint
s to the specified organization and
bucket.
sourceimpl Client
impl Client
sourcepub fn new(
url: impl Into<String>,
org: impl Into<String>,
auth_token: impl Into<String>
) -> Self
pub fn new(
url: impl Into<String>,
org: impl Into<String>,
auth_token: impl Into<String>
) -> Self
Create a new client pointing to the URL specified in
protocol://server:port
format and using the specified token for
authorization.
Example
let client = influxdb2::Client::new("http://localhost:8888", "org", "my-token");
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more