Skip to main content

aws_sdk_appflow/types/
_google_analytics_connector_profile_credentials.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The connector-specific profile credentials required by Google Analytics.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
6pub struct GoogleAnalyticsConnectorProfileCredentials {
7    /// <p>The identifier for the desired client.</p>
8    pub client_id: ::std::string::String,
9    /// <p>The client secret used by the OAuth client to authenticate to the authorization server.</p>
10    pub client_secret: ::std::string::String,
11    /// <p>The credentials used to access protected Google Analytics resources.</p>
12    pub access_token: ::std::option::Option<::std::string::String>,
13    /// <p>The credentials used to acquire new access tokens. This is required only for OAuth2 access tokens, and is not required for OAuth1 access tokens.</p>
14    pub refresh_token: ::std::option::Option<::std::string::String>,
15    /// <p>The OAuth requirement needed to request security tokens from the connector endpoint.</p>
16    pub o_auth_request: ::std::option::Option<crate::types::ConnectorOAuthRequest>,
17}
18impl GoogleAnalyticsConnectorProfileCredentials {
19    /// <p>The identifier for the desired client.</p>
20    pub fn client_id(&self) -> &str {
21        use std::ops::Deref;
22        self.client_id.deref()
23    }
24    /// <p>The client secret used by the OAuth client to authenticate to the authorization server.</p>
25    pub fn client_secret(&self) -> &str {
26        use std::ops::Deref;
27        self.client_secret.deref()
28    }
29    /// <p>The credentials used to access protected Google Analytics resources.</p>
30    pub fn access_token(&self) -> ::std::option::Option<&str> {
31        self.access_token.as_deref()
32    }
33    /// <p>The credentials used to acquire new access tokens. This is required only for OAuth2 access tokens, and is not required for OAuth1 access tokens.</p>
34    pub fn refresh_token(&self) -> ::std::option::Option<&str> {
35        self.refresh_token.as_deref()
36    }
37    /// <p>The OAuth requirement needed to request security tokens from the connector endpoint.</p>
38    pub fn o_auth_request(&self) -> ::std::option::Option<&crate::types::ConnectorOAuthRequest> {
39        self.o_auth_request.as_ref()
40    }
41}
42impl ::std::fmt::Debug for GoogleAnalyticsConnectorProfileCredentials {
43    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
44        let mut formatter = f.debug_struct("GoogleAnalyticsConnectorProfileCredentials");
45        formatter.field("client_id", &self.client_id);
46        formatter.field("client_secret", &"*** Sensitive Data Redacted ***");
47        formatter.field("access_token", &"*** Sensitive Data Redacted ***");
48        formatter.field("refresh_token", &self.refresh_token);
49        formatter.field("o_auth_request", &self.o_auth_request);
50        formatter.finish()
51    }
52}
53impl GoogleAnalyticsConnectorProfileCredentials {
54    /// Creates a new builder-style object to manufacture [`GoogleAnalyticsConnectorProfileCredentials`](crate::types::GoogleAnalyticsConnectorProfileCredentials).
55    pub fn builder() -> crate::types::builders::GoogleAnalyticsConnectorProfileCredentialsBuilder {
56        crate::types::builders::GoogleAnalyticsConnectorProfileCredentialsBuilder::default()
57    }
58}
59
60/// A builder for [`GoogleAnalyticsConnectorProfileCredentials`](crate::types::GoogleAnalyticsConnectorProfileCredentials).
61#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
62#[non_exhaustive]
63pub struct GoogleAnalyticsConnectorProfileCredentialsBuilder {
64    pub(crate) client_id: ::std::option::Option<::std::string::String>,
65    pub(crate) client_secret: ::std::option::Option<::std::string::String>,
66    pub(crate) access_token: ::std::option::Option<::std::string::String>,
67    pub(crate) refresh_token: ::std::option::Option<::std::string::String>,
68    pub(crate) o_auth_request: ::std::option::Option<crate::types::ConnectorOAuthRequest>,
69}
70impl GoogleAnalyticsConnectorProfileCredentialsBuilder {
71    /// <p>The identifier for the desired client.</p>
72    /// This field is required.
73    pub fn client_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
74        self.client_id = ::std::option::Option::Some(input.into());
75        self
76    }
77    /// <p>The identifier for the desired client.</p>
78    pub fn set_client_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
79        self.client_id = input;
80        self
81    }
82    /// <p>The identifier for the desired client.</p>
83    pub fn get_client_id(&self) -> &::std::option::Option<::std::string::String> {
84        &self.client_id
85    }
86    /// <p>The client secret used by the OAuth client to authenticate to the authorization server.</p>
87    /// This field is required.
88    pub fn client_secret(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
89        self.client_secret = ::std::option::Option::Some(input.into());
90        self
91    }
92    /// <p>The client secret used by the OAuth client to authenticate to the authorization server.</p>
93    pub fn set_client_secret(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
94        self.client_secret = input;
95        self
96    }
97    /// <p>The client secret used by the OAuth client to authenticate to the authorization server.</p>
98    pub fn get_client_secret(&self) -> &::std::option::Option<::std::string::String> {
99        &self.client_secret
100    }
101    /// <p>The credentials used to access protected Google Analytics resources.</p>
102    pub fn access_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
103        self.access_token = ::std::option::Option::Some(input.into());
104        self
105    }
106    /// <p>The credentials used to access protected Google Analytics resources.</p>
107    pub fn set_access_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
108        self.access_token = input;
109        self
110    }
111    /// <p>The credentials used to access protected Google Analytics resources.</p>
112    pub fn get_access_token(&self) -> &::std::option::Option<::std::string::String> {
113        &self.access_token
114    }
115    /// <p>The credentials used to acquire new access tokens. This is required only for OAuth2 access tokens, and is not required for OAuth1 access tokens.</p>
116    pub fn refresh_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
117        self.refresh_token = ::std::option::Option::Some(input.into());
118        self
119    }
120    /// <p>The credentials used to acquire new access tokens. This is required only for OAuth2 access tokens, and is not required for OAuth1 access tokens.</p>
121    pub fn set_refresh_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
122        self.refresh_token = input;
123        self
124    }
125    /// <p>The credentials used to acquire new access tokens. This is required only for OAuth2 access tokens, and is not required for OAuth1 access tokens.</p>
126    pub fn get_refresh_token(&self) -> &::std::option::Option<::std::string::String> {
127        &self.refresh_token
128    }
129    /// <p>The OAuth requirement needed to request security tokens from the connector endpoint.</p>
130    pub fn o_auth_request(mut self, input: crate::types::ConnectorOAuthRequest) -> Self {
131        self.o_auth_request = ::std::option::Option::Some(input);
132        self
133    }
134    /// <p>The OAuth requirement needed to request security tokens from the connector endpoint.</p>
135    pub fn set_o_auth_request(mut self, input: ::std::option::Option<crate::types::ConnectorOAuthRequest>) -> Self {
136        self.o_auth_request = input;
137        self
138    }
139    /// <p>The OAuth requirement needed to request security tokens from the connector endpoint.</p>
140    pub fn get_o_auth_request(&self) -> &::std::option::Option<crate::types::ConnectorOAuthRequest> {
141        &self.o_auth_request
142    }
143    /// Consumes the builder and constructs a [`GoogleAnalyticsConnectorProfileCredentials`](crate::types::GoogleAnalyticsConnectorProfileCredentials).
144    /// This method will fail if any of the following fields are not set:
145    /// - [`client_id`](crate::types::builders::GoogleAnalyticsConnectorProfileCredentialsBuilder::client_id)
146    /// - [`client_secret`](crate::types::builders::GoogleAnalyticsConnectorProfileCredentialsBuilder::client_secret)
147    pub fn build(
148        self,
149    ) -> ::std::result::Result<crate::types::GoogleAnalyticsConnectorProfileCredentials, ::aws_smithy_types::error::operation::BuildError> {
150        ::std::result::Result::Ok(crate::types::GoogleAnalyticsConnectorProfileCredentials {
151            client_id: self.client_id.ok_or_else(|| {
152                ::aws_smithy_types::error::operation::BuildError::missing_field(
153                    "client_id",
154                    "client_id was not specified but it is required when building GoogleAnalyticsConnectorProfileCredentials",
155                )
156            })?,
157            client_secret: self.client_secret.ok_or_else(|| {
158                ::aws_smithy_types::error::operation::BuildError::missing_field(
159                    "client_secret",
160                    "client_secret was not specified but it is required when building GoogleAnalyticsConnectorProfileCredentials",
161                )
162            })?,
163            access_token: self.access_token,
164            refresh_token: self.refresh_token,
165            o_auth_request: self.o_auth_request,
166        })
167    }
168}
169impl ::std::fmt::Debug for GoogleAnalyticsConnectorProfileCredentialsBuilder {
170    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
171        let mut formatter = f.debug_struct("GoogleAnalyticsConnectorProfileCredentialsBuilder");
172        formatter.field("client_id", &self.client_id);
173        formatter.field("client_secret", &"*** Sensitive Data Redacted ***");
174        formatter.field("access_token", &"*** Sensitive Data Redacted ***");
175        formatter.field("refresh_token", &self.refresh_token);
176        formatter.field("o_auth_request", &self.o_auth_request);
177        formatter.finish()
178    }
179}