pub struct SchemaService { /* private fields */ }Expand description
Implements a client for the Cloud Pub/Sub API.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
let client = SchemaService::builder().build().await?;
let parent = "parent_value";
let mut list = client.list_schemas()
.set_parent(parent)
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}§Service Description
Service for doing schema-related operations.
§Configuration
To configure SchemaService use the with_* methods in the type returned
by builder(). The default configuration should
work for most applications. Common configuration changes include
- with_endpoint(): by default this client uses the global default endpoint
(
https://pubsub.googleapis.com). Applications using regional endpoints or running in restricted networks (e.g. a network configured override this default. - with_credentials(): by default this client uses Application Default Credentials. Applications using custom authentication may need to override this default.
§Pooling and Cloning
SchemaService holds a connection pool internally, it is advised to
create one and reuse it. You do not need to wrap SchemaService in
an Rc or Arc to reuse it, because it
already uses an Arc internally.
Implementations§
Source§impl SchemaService
impl SchemaService
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Returns a builder for SchemaService.
let client = SchemaService::builder().build().await?;Sourcepub fn from_stub<T>(stub: T) -> Selfwhere
T: SchemaService + 'static,
pub fn from_stub<T>(stub: T) -> Selfwhere
T: SchemaService + 'static,
Creates a new client from the provided stub.
The most common case for calling this function is in tests mocking the client’s behavior.
Sourcepub fn create_schema(&self) -> CreateSchema
pub fn create_schema(&self) -> CreateSchema
Creates a schema.
§Example
use google_cloud_pubsub::model::Schema;
use google_cloud_pubsub::Result;
async fn sample(
client: &SchemaService, parent: &str
) -> Result<()> {
let response = client.create_schema()
.set_parent(parent)
.set_schema_id("schema_id_value")
.set_schema(
Schema::new()/* set fields */
)
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn get_schema(&self) -> GetSchema
pub fn get_schema(&self) -> GetSchema
Gets a schema.
§Example
use google_cloud_pubsub::Result;
async fn sample(
client: &SchemaService, name: &str
) -> Result<()> {
let response = client.get_schema()
.set_name(name)
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn list_schemas(&self) -> ListSchemas
pub fn list_schemas(&self) -> ListSchemas
Lists schemas in a project.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
use google_cloud_pubsub::Result;
async fn sample(
client: &SchemaService, parent: &str
) -> Result<()> {
let mut list = client.list_schemas()
.set_parent(parent)
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}Sourcepub fn list_schema_revisions(&self) -> ListSchemaRevisions
pub fn list_schema_revisions(&self) -> ListSchemaRevisions
Lists all schema revisions for the named schema.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
use google_cloud_pubsub::Result;
async fn sample(
client: &SchemaService
) -> Result<()> {
let mut list = client.list_schema_revisions()
/* set fields */
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}Sourcepub fn commit_schema(&self) -> CommitSchema
pub fn commit_schema(&self) -> CommitSchema
Commits a new schema revision to an existing schema.
§Example
use google_cloud_pubsub::Result;
async fn sample(
client: &SchemaService
) -> Result<()> {
let response = client.commit_schema()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn rollback_schema(&self) -> RollbackSchema
pub fn rollback_schema(&self) -> RollbackSchema
Creates a new schema revision that is a copy of the provided revision_id.
§Example
use google_cloud_pubsub::Result;
async fn sample(
client: &SchemaService
) -> Result<()> {
let response = client.rollback_schema()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn delete_schema_revision(&self) -> DeleteSchemaRevision
pub fn delete_schema_revision(&self) -> DeleteSchemaRevision
Deletes a specific schema revision.
§Example
use google_cloud_pubsub::Result;
async fn sample(
client: &SchemaService, name: &str
) -> Result<()> {
let response = client.delete_schema_revision()
.set_name(name)
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn delete_schema(&self) -> DeleteSchema
pub fn delete_schema(&self) -> DeleteSchema
Deletes a schema.
§Example
use google_cloud_pubsub::Result;
async fn sample(
client: &SchemaService, name: &str
) -> Result<()> {
client.delete_schema()
.set_name(name)
.send().await?;
Ok(())
}Sourcepub fn validate_schema(&self) -> ValidateSchema
pub fn validate_schema(&self) -> ValidateSchema
Validates a schema.
§Example
use google_cloud_pubsub::Result;
async fn sample(
client: &SchemaService
) -> Result<()> {
let response = client.validate_schema()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn validate_message(&self) -> ValidateMessage
pub fn validate_message(&self) -> ValidateMessage
Validates a message against a schema.
§Example
use google_cloud_pubsub::Result;
async fn sample(
client: &SchemaService
) -> Result<()> {
let response = client.validate_message()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn set_iam_policy(&self) -> SetIamPolicy
pub fn set_iam_policy(&self) -> SetIamPolicy
Sets the access control policy on the specified resource. Replaces any existing policy.
Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED
errors.
§Example
use google_cloud_pubsub::Result;
async fn sample(
client: &SchemaService
) -> Result<()> {
let response = client.set_iam_policy()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn get_iam_policy(&self) -> GetIamPolicy
pub fn get_iam_policy(&self) -> GetIamPolicy
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
§Example
use google_cloud_pubsub::Result;
async fn sample(
client: &SchemaService
) -> Result<()> {
let response = client.get_iam_policy()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn test_iam_permissions(&self) -> TestIamPermissions
pub fn test_iam_permissions(&self) -> TestIamPermissions
Returns permissions that a caller has on the specified resource. If the
resource does not exist, this will return an empty set of
permissions, not a NOT_FOUND error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may “fail open” without warning.
§Example
use google_cloud_pubsub::Result;
async fn sample(
client: &SchemaService
) -> Result<()> {
let response = client.test_iam_permissions()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Trait Implementations§
Source§impl Clone for SchemaService
impl Clone for SchemaService
Source§fn clone(&self) -> SchemaService
fn clone(&self) -> SchemaService
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SchemaService
impl !RefUnwindSafe for SchemaService
impl Send for SchemaService
impl Sync for SchemaService
impl Unpin for SchemaService
impl UnsafeUnpin for SchemaService
impl !UnwindSafe for SchemaService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request