1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
// This file is @generated by prost-build.
/// A resource message representing a Google Marketing Platform organization.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Organization {
    /// Identifier. The resource name of the GMP organization.
    /// Format: organizations/{org_id}
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    /// The human-readable name for the organization.
    #[prost(string, tag = "2")]
    pub display_name: ::prost::alloc::string::String,
}
/// A resource message representing the link between a Google Analytics account
/// and a Google Marketing Platform organization.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AnalyticsAccountLink {
    /// Identifier. Resource name of this AnalyticsAccountLink. Note the resource
    /// ID is the same as the ID of the Analtyics account.
    ///
    /// Format:
    /// organizations/{org_id}/analyticsAccountLinks/{analytics_account_link_id}
    /// Example: "organizations/xyz/analyticsAccountLinks/1234"
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    /// Required. Immutable. The resource name of the AnalyticsAdmin API account.
    /// The account ID will be used as the ID of this AnalyticsAccountLink
    /// resource, which will become the final component of the resource name.
    ///
    /// Format: analyticsadmin.googleapis.com/accounts/{account_id}
    #[prost(string, tag = "2")]
    pub analytics_account: ::prost::alloc::string::String,
    /// Output only. The human-readable name for the Analytics account.
    #[prost(string, tag = "3")]
    pub display_name: ::prost::alloc::string::String,
    /// Output only. The verification state of the link between the Analytics
    /// account and the parent organization.
    #[prost(enumeration = "LinkVerificationState", tag = "4")]
    pub link_verification_state: i32,
}
/// The verification state of the link between a product account and a GMP
/// organization.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum LinkVerificationState {
    /// The link state is unknown.
    Unspecified = 0,
    /// The link is established.
    Verified = 1,
    /// The link is requested, but hasn't been approved by the product account
    /// admin.
    NotVerified = 2,
}
impl LinkVerificationState {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            LinkVerificationState::Unspecified => "LINK_VERIFICATION_STATE_UNSPECIFIED",
            LinkVerificationState::Verified => "LINK_VERIFICATION_STATE_VERIFIED",
            LinkVerificationState::NotVerified => "LINK_VERIFICATION_STATE_NOT_VERIFIED",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "LINK_VERIFICATION_STATE_UNSPECIFIED" => Some(Self::Unspecified),
            "LINK_VERIFICATION_STATE_VERIFIED" => Some(Self::Verified),
            "LINK_VERIFICATION_STATE_NOT_VERIFIED" => Some(Self::NotVerified),
            _ => None,
        }
    }
}
/// Request message for GetOrganization RPC.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetOrganizationRequest {
    /// Required. The name of the Organization to retrieve.
    /// Format: organizations/{org_id}
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
}
/// Request message for ListAnalyticsAccountLinks RPC.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListAnalyticsAccountLinksRequest {
    /// Required. The parent organization, which owns this collection of Analytics
    /// account links. Format: organizations/{org_id}
    #[prost(string, tag = "1")]
    pub parent: ::prost::alloc::string::String,
    /// Optional. The maximum number of Analytics account links to return in one
    /// call. The service may return fewer than this value.
    ///
    /// If unspecified, at most 50 Analytics account links will be returned. The
    /// maximum value is 1000; values above 1000 will be coerced to 1000.
    #[prost(int32, tag = "2")]
    pub page_size: i32,
    /// Optional. A page token, received from a previous ListAnalyticsAccountLinks
    /// call. Provide this to retrieve the subsequent page.
    ///
    /// When paginating, all other parameters provided to
    /// `ListAnalyticsAccountLinks` must match the call that provided the page
    /// token.
    #[prost(string, tag = "3")]
    pub page_token: ::prost::alloc::string::String,
}
/// Response message for ListAnalyticsAccountLinks RPC.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListAnalyticsAccountLinksResponse {
    /// Analytics account links in this organization.
    #[prost(message, repeated, tag = "1")]
    pub analytics_account_links: ::prost::alloc::vec::Vec<AnalyticsAccountLink>,
    /// A token, which can be sent as `page_token` to retrieve the next page.
    /// If this field is omitted, there are no subsequent pages.
    #[prost(string, tag = "2")]
    pub next_page_token: ::prost::alloc::string::String,
}
/// Request message for CreateAnalyticsAccountLink RPC.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateAnalyticsAccountLinkRequest {
    /// Required. The parent resource where this Analytics account link will be
    /// created. Format: organizations/{org_id}
    #[prost(string, tag = "1")]
    pub parent: ::prost::alloc::string::String,
    /// Required. The Analytics account link to create.
    #[prost(message, optional, tag = "2")]
    pub analytics_account_link: ::core::option::Option<AnalyticsAccountLink>,
}
/// Request message for DeleteAnalyticsAccountLink RPC.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteAnalyticsAccountLinkRequest {
    /// Required. The name of the Analytics account link to delete.
    /// Format:
    /// organizations/{org_id}/analyticsAccountLinks/{analytics_account_link_id}
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
}
/// Request message for SetPropertyServiceLevel RPC.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SetPropertyServiceLevelRequest {
    /// Required. The parent AnalyticsAccountLink scope where this property is in.
    /// Format:
    /// organizations/{org_id}/analyticsAccountLinks/{analytics_account_link_id}
    #[prost(string, tag = "1")]
    pub analytics_account_link: ::prost::alloc::string::String,
    /// Required. The Analytics property to change the ServiceLevel setting. This
    /// field is the name of the Google Analytics Admin API property resource.
    ///
    /// Format: analyticsadmin.googleapis.com/properties/{property_id}
    #[prost(string, tag = "2")]
    pub analytics_property: ::prost::alloc::string::String,
    /// Required. The service level to set for this property.
    #[prost(enumeration = "AnalyticsServiceLevel", tag = "3")]
    pub service_level: i32,
}
/// Response message for SetPropertyServiceLevel RPC.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SetPropertyServiceLevelResponse {}
/// Various levels of service for Google Analytics.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum AnalyticsServiceLevel {
    /// Service level unspecified.
    Unspecified = 0,
    /// The standard version of Google Analytics.
    Standard = 1,
    /// The premium version of Google Analytics.
    AnalyticsServiceLevel360 = 2,
}
impl AnalyticsServiceLevel {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            AnalyticsServiceLevel::Unspecified => "ANALYTICS_SERVICE_LEVEL_UNSPECIFIED",
            AnalyticsServiceLevel::Standard => "ANALYTICS_SERVICE_LEVEL_STANDARD",
            AnalyticsServiceLevel::AnalyticsServiceLevel360 => {
                "ANALYTICS_SERVICE_LEVEL_360"
            }
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "ANALYTICS_SERVICE_LEVEL_UNSPECIFIED" => Some(Self::Unspecified),
            "ANALYTICS_SERVICE_LEVEL_STANDARD" => Some(Self::Standard),
            "ANALYTICS_SERVICE_LEVEL_360" => Some(Self::AnalyticsServiceLevel360),
            _ => None,
        }
    }
}
/// Generated client implementations.
pub mod marketingplatform_admin_service_client {
    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    /// Service Interface for the Google Marketing Platform Admin API.
    #[derive(Debug, Clone)]
    pub struct MarketingplatformAdminServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl<T> MarketingplatformAdminServiceClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::BoxBody>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
    {
        pub fn new(inner: T) -> Self {
            let inner = tonic::client::Grpc::new(inner);
            Self { inner }
        }
        pub fn with_origin(inner: T, origin: Uri) -> Self {
            let inner = tonic::client::Grpc::with_origin(inner, origin);
            Self { inner }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> MarketingplatformAdminServiceClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::BoxBody>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::BoxBody>,
            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
        {
            MarketingplatformAdminServiceClient::new(
                InterceptedService::new(inner, interceptor),
            )
        }
        /// Compress requests with the given encoding.
        ///
        /// This requires the server to support it otherwise it might respond with an
        /// error.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.send_compressed(encoding);
            self
        }
        /// Enable decompressing responses.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.accept_compressed(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_decoding_message_size(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_encoding_message_size(limit);
            self
        }
        /// Lookup for a single organization.
        pub async fn get_organization(
            &mut self,
            request: impl tonic::IntoRequest<super::GetOrganizationRequest>,
        ) -> std::result::Result<tonic::Response<super::Organization>, tonic::Status> {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::new(
                        tonic::Code::Unknown,
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/google.marketingplatform.admin.v1alpha.MarketingplatformAdminService/GetOrganization",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.marketingplatform.admin.v1alpha.MarketingplatformAdminService",
                        "GetOrganization",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Lists the Google Analytics accounts link to the specified Google Marketing
        /// Platform organization.
        pub async fn list_analytics_account_links(
            &mut self,
            request: impl tonic::IntoRequest<super::ListAnalyticsAccountLinksRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ListAnalyticsAccountLinksResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::new(
                        tonic::Code::Unknown,
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/google.marketingplatform.admin.v1alpha.MarketingplatformAdminService/ListAnalyticsAccountLinks",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.marketingplatform.admin.v1alpha.MarketingplatformAdminService",
                        "ListAnalyticsAccountLinks",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Creates the link between the Analytics account and the Google Marketing
        /// Platform organization.
        ///
        /// User needs to be an org user, and admin on the Analytics account to create
        /// the link. If the account is already linked to an organization, user needs
        /// to unlink the account from the current organization, then try link again.
        pub async fn create_analytics_account_link(
            &mut self,
            request: impl tonic::IntoRequest<super::CreateAnalyticsAccountLinkRequest>,
        ) -> std::result::Result<
            tonic::Response<super::AnalyticsAccountLink>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::new(
                        tonic::Code::Unknown,
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/google.marketingplatform.admin.v1alpha.MarketingplatformAdminService/CreateAnalyticsAccountLink",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.marketingplatform.admin.v1alpha.MarketingplatformAdminService",
                        "CreateAnalyticsAccountLink",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Deletes the AnalyticsAccountLink, which detaches the Analytics account from
        /// the Google Marketing Platform organization.
        ///
        /// User needs to be an org user, and admin on the Analytics account in order
        /// to delete the link.
        pub async fn delete_analytics_account_link(
            &mut self,
            request: impl tonic::IntoRequest<super::DeleteAnalyticsAccountLinkRequest>,
        ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::new(
                        tonic::Code::Unknown,
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/google.marketingplatform.admin.v1alpha.MarketingplatformAdminService/DeleteAnalyticsAccountLink",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.marketingplatform.admin.v1alpha.MarketingplatformAdminService",
                        "DeleteAnalyticsAccountLink",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Updates the service level for an Analytics property.
        pub async fn set_property_service_level(
            &mut self,
            request: impl tonic::IntoRequest<super::SetPropertyServiceLevelRequest>,
        ) -> std::result::Result<
            tonic::Response<super::SetPropertyServiceLevelResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::new(
                        tonic::Code::Unknown,
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/google.marketingplatform.admin.v1alpha.MarketingplatformAdminService/SetPropertyServiceLevel",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.marketingplatform.admin.v1alpha.MarketingplatformAdminService",
                        "SetPropertyServiceLevel",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}