Skip to main content

GenericWebService

Struct GenericWebService 

Source
#[non_exhaustive]
pub struct GenericWebService {
Show 14 fields pub uri: String, pub username: String, pub password: String, pub secret_version_for_username_password: String, pub request_headers: HashMap<String, String>, pub secret_versions_for_request_headers: HashMap<String, SecretVersionHeaderValue>, pub allowed_ca_certs: Vec<Bytes>, pub oauth_config: Option<OAuthConfig>, pub service_agent_auth: ServiceAgentAuth, pub service_account_auth_config: Option<ServiceAccountAuthConfig>, pub webhook_type: WebhookType, pub http_method: HttpMethod, pub request_body: String, pub parameter_mapping: HashMap<String, String>, /* private fields */
}
Available on crate features environments or webhooks only.
Expand description

Represents configuration for a generic web service.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§uri: String

Required. The webhook URI for receiving POST requests. It must use https protocol.

§username: String
👎Deprecated

The user name for HTTP Basic authentication.

§password: String
👎Deprecated

The password for HTTP Basic authentication.

§secret_version_for_username_password: String

Optional. The SecretManager secret version resource storing the username:password pair for HTTP Basic authentication. Format: projects/{project}/secrets/{secret}/versions/{version}

§request_headers: HashMap<String, String>

The HTTP request headers to send together with webhook requests.

§secret_versions_for_request_headers: HashMap<String, SecretVersionHeaderValue>

Optional. The HTTP request headers to send together with webhook requests. Header values are stored in SecretManager secret versions.

When the same header name is specified in both request_headers and secret_versions_for_request_headers, the value in secret_versions_for_request_headers will be used.

§allowed_ca_certs: Vec<Bytes>

Optional. Specifies a list of allowed custom CA certificates (in DER format) for HTTPS verification. This overrides the default SSL trust store. If this is empty or unspecified, Dialogflow will use Google’s default trust store to verify certificates. N.B. Make sure the HTTPS server certificates are signed with “subject alt name”. For instance a certificate can be self-signed using the following command,

   openssl x509 -req -days 200 -in example.com.csr \
     -signkey example.com.key \
     -out example.com.crt \
     -extfile <(printf "\nsubjectAltName='DNS:www.example.com'")
§oauth_config: Option<OAuthConfig>

Optional. The OAuth configuration of the webhook. If specified, Dialogflow will initiate the OAuth client credential flow to exchange an access token from the 3rd party platform and put it in the auth header.

§service_agent_auth: ServiceAgentAuth

Optional. Indicate the auth token type generated from the Diglogflow service agent. The generated token is sent in the Authorization header.

§service_account_auth_config: Option<ServiceAccountAuthConfig>

Optional. Configuration for service account authentication.

§webhook_type: WebhookType

Optional. Type of the webhook.

§http_method: HttpMethod

Optional. HTTP method for the flexible webhook calls. Standard webhook always uses POST.

§request_body: String

Optional. Defines a custom JSON object as request body to send to flexible webhook.

§parameter_mapping: HashMap<String, String>

Optional. Maps the values extracted from specific fields of the flexible webhook response into session parameters.

  • Key: session parameter name
  • Value: field path in the webhook response

Implementations§

Source§

impl GenericWebService

Source

pub fn new() -> Self

Creates a new default instance.

Source

pub fn set_uri<T: Into<String>>(self, v: T) -> Self

Sets the value of uri.

§Example
let x = GenericWebService::new().set_uri("example");
Source

pub fn set_username<T: Into<String>>(self, v: T) -> Self

👎Deprecated

Sets the value of username.

§Example
let x = GenericWebService::new().set_username("example");
Source

pub fn set_password<T: Into<String>>(self, v: T) -> Self

👎Deprecated

Sets the value of password.

§Example
let x = GenericWebService::new().set_password("example");
Source

pub fn set_secret_version_for_username_password<T: Into<String>>( self, v: T, ) -> Self

Sets the value of secret_version_for_username_password.

§Example
let x = GenericWebService::new().set_secret_version_for_username_password("example");
Source

pub fn set_request_headers<T, K, V>(self, v: T) -> Self
where T: IntoIterator<Item = (K, V)>, K: Into<String>, V: Into<String>,

Sets the value of request_headers.

§Example
let x = GenericWebService::new().set_request_headers([
    ("key0", "abc"),
    ("key1", "xyz"),
]);
Source

pub fn set_secret_versions_for_request_headers<T, K, V>(self, v: T) -> Self

Sets the value of secret_versions_for_request_headers.

§Example
use google_cloud_dialogflow_cx_v3::model::webhook::generic_web_service::SecretVersionHeaderValue;
let x = GenericWebService::new().set_secret_versions_for_request_headers([
    ("key0", SecretVersionHeaderValue::default()/* use setters */),
    ("key1", SecretVersionHeaderValue::default()/* use (different) setters */),
]);
Source

pub fn set_allowed_ca_certs<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<Bytes>,

Sets the value of allowed_ca_certs.

§Example
let b1 = bytes::Bytes::from_static(b"abc");
let b2 = bytes::Bytes::from_static(b"xyz");
let x = GenericWebService::new().set_allowed_ca_certs([b1, b2]);
Source

pub fn set_oauth_config<T>(self, v: T) -> Self
where T: Into<OAuthConfig>,

Sets the value of oauth_config.

§Example
use google_cloud_dialogflow_cx_v3::model::webhook::generic_web_service::OAuthConfig;
let x = GenericWebService::new().set_oauth_config(OAuthConfig::default()/* use setters */);
Source

pub fn set_or_clear_oauth_config<T>(self, v: Option<T>) -> Self
where T: Into<OAuthConfig>,

Sets or clears the value of oauth_config.

§Example
use google_cloud_dialogflow_cx_v3::model::webhook::generic_web_service::OAuthConfig;
let x = GenericWebService::new().set_or_clear_oauth_config(Some(OAuthConfig::default()/* use setters */));
let x = GenericWebService::new().set_or_clear_oauth_config(None::<OAuthConfig>);
Source

pub fn set_service_agent_auth<T: Into<ServiceAgentAuth>>(self, v: T) -> Self

Sets the value of service_agent_auth.

§Example
use google_cloud_dialogflow_cx_v3::model::webhook::generic_web_service::ServiceAgentAuth;
let x0 = GenericWebService::new().set_service_agent_auth(ServiceAgentAuth::None);
let x1 = GenericWebService::new().set_service_agent_auth(ServiceAgentAuth::IdToken);
let x2 = GenericWebService::new().set_service_agent_auth(ServiceAgentAuth::AccessToken);
Source

pub fn set_service_account_auth_config<T>(self, v: T) -> Self

Sets the value of service_account_auth_config.

§Example
use google_cloud_dialogflow_cx_v3::model::webhook::generic_web_service::ServiceAccountAuthConfig;
let x = GenericWebService::new().set_service_account_auth_config(ServiceAccountAuthConfig::default()/* use setters */);
Source

pub fn set_or_clear_service_account_auth_config<T>(self, v: Option<T>) -> Self

Sets or clears the value of service_account_auth_config.

§Example
use google_cloud_dialogflow_cx_v3::model::webhook::generic_web_service::ServiceAccountAuthConfig;
let x = GenericWebService::new().set_or_clear_service_account_auth_config(Some(ServiceAccountAuthConfig::default()/* use setters */));
let x = GenericWebService::new().set_or_clear_service_account_auth_config(None::<ServiceAccountAuthConfig>);
Source

pub fn set_webhook_type<T: Into<WebhookType>>(self, v: T) -> Self

Sets the value of webhook_type.

§Example
use google_cloud_dialogflow_cx_v3::model::webhook::generic_web_service::WebhookType;
let x0 = GenericWebService::new().set_webhook_type(WebhookType::Standard);
let x1 = GenericWebService::new().set_webhook_type(WebhookType::Flexible);
Source

pub fn set_http_method<T: Into<HttpMethod>>(self, v: T) -> Self

Sets the value of http_method.

§Example
use google_cloud_dialogflow_cx_v3::model::webhook::generic_web_service::HttpMethod;
let x0 = GenericWebService::new().set_http_method(HttpMethod::Post);
let x1 = GenericWebService::new().set_http_method(HttpMethod::Get);
let x2 = GenericWebService::new().set_http_method(HttpMethod::Head);
Source

pub fn set_request_body<T: Into<String>>(self, v: T) -> Self

Sets the value of request_body.

§Example
let x = GenericWebService::new().set_request_body("example");
Source

pub fn set_parameter_mapping<T, K, V>(self, v: T) -> Self
where T: IntoIterator<Item = (K, V)>, K: Into<String>, V: Into<String>,

Sets the value of parameter_mapping.

§Example
let x = GenericWebService::new().set_parameter_mapping([
    ("key0", "abc"),
    ("key1", "xyz"),
]);

Trait Implementations§

Source§

impl Clone for GenericWebService

Source§

fn clone(&self) -> GenericWebService

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 GenericWebService

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for GenericWebService

Source§

fn default() -> GenericWebService

Returns the “default value” for a type. Read more
Source§

impl Message for GenericWebService

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for GenericWebService

Source§

fn eq(&self, other: &GenericWebService) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for GenericWebService

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

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