rusoto_detective/
generated.rs

1// =================================================================
2//
3//                           * WARNING *
4//
5//                    This file is generated!
6//
7//  Changes made to this file will be overwritten. If changes are
8//  required to the generated code, the service_crategen project
9//  must be updated to generate the changes.
10//
11// =================================================================
12
13use std::error::Error;
14use std::fmt;
15
16use async_trait::async_trait;
17use rusoto_core::credential::ProvideAwsCredentials;
18use rusoto_core::region;
19use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
20use rusoto_core::{Client, RusotoError};
21
22use rusoto_core::proto;
23use rusoto_core::signature::SignedRequest;
24#[allow(unused_imports)]
25use serde::{Deserialize, Serialize};
26use serde_json;
27#[derive(Clone, Debug, Default, PartialEq, Serialize)]
28#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
29pub struct AcceptInvitationRequest {
30    /// <p>The ARN of the behavior graph that the member account is accepting the invitation for.</p> <p>The member account status in the behavior graph must be <code>INVITED</code>.</p>
31    #[serde(rename = "GraphArn")]
32    pub graph_arn: String,
33}
34
35/// <p>An AWS account that is the master of or a member of a behavior graph.</p>
36#[derive(Clone, Debug, Default, PartialEq, Serialize)]
37#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
38pub struct Account {
39    /// <p>The account identifier of the AWS account.</p>
40    #[serde(rename = "AccountId")]
41    pub account_id: String,
42    /// <p>The AWS account root user email address for the AWS account.</p>
43    #[serde(rename = "EmailAddress")]
44    pub email_address: String,
45}
46
47#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
48#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
49pub struct CreateGraphResponse {
50    /// <p>The ARN of the new behavior graph.</p>
51    #[serde(rename = "GraphArn")]
52    #[serde(skip_serializing_if = "Option::is_none")]
53    pub graph_arn: Option<String>,
54}
55
56#[derive(Clone, Debug, Default, PartialEq, Serialize)]
57#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
58pub struct CreateMembersRequest {
59    /// <p>The list of AWS accounts to invite to become member accounts in the behavior graph. For each invited account, the account list contains the account identifier and the AWS account root user email address.</p>
60    #[serde(rename = "Accounts")]
61    pub accounts: Vec<Account>,
62    /// <p>The ARN of the behavior graph to invite the member accounts to contribute their data to.</p>
63    #[serde(rename = "GraphArn")]
64    pub graph_arn: String,
65    /// <p>Customized message text to include in the invitation email message to the invited member accounts.</p>
66    #[serde(rename = "Message")]
67    #[serde(skip_serializing_if = "Option::is_none")]
68    pub message: Option<String>,
69}
70
71#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
72#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
73pub struct CreateMembersResponse {
74    /// <p>The set of member account invitation requests that Detective was able to process. This includes accounts that are being verified, that failed verification, and that passed verification and are being sent an invitation.</p>
75    #[serde(rename = "Members")]
76    #[serde(skip_serializing_if = "Option::is_none")]
77    pub members: Option<Vec<MemberDetail>>,
78    /// <p>The list of accounts for which Detective was unable to process the invitation request. For each account, the list provides the reason why the request could not be processed. The list includes accounts that are already member accounts in the behavior graph.</p>
79    #[serde(rename = "UnprocessedAccounts")]
80    #[serde(skip_serializing_if = "Option::is_none")]
81    pub unprocessed_accounts: Option<Vec<UnprocessedAccount>>,
82}
83
84#[derive(Clone, Debug, Default, PartialEq, Serialize)]
85#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
86pub struct DeleteGraphRequest {
87    /// <p>The ARN of the behavior graph to disable.</p>
88    #[serde(rename = "GraphArn")]
89    pub graph_arn: String,
90}
91
92#[derive(Clone, Debug, Default, PartialEq, Serialize)]
93#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
94pub struct DeleteMembersRequest {
95    /// <p>The list of AWS account identifiers for the member accounts to delete from the behavior graph.</p>
96    #[serde(rename = "AccountIds")]
97    pub account_ids: Vec<String>,
98    /// <p>The ARN of the behavior graph to delete members from.</p>
99    #[serde(rename = "GraphArn")]
100    pub graph_arn: String,
101}
102
103#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
104#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
105pub struct DeleteMembersResponse {
106    /// <p>The list of AWS account identifiers for the member accounts that Detective successfully deleted from the behavior graph.</p>
107    #[serde(rename = "AccountIds")]
108    #[serde(skip_serializing_if = "Option::is_none")]
109    pub account_ids: Option<Vec<String>>,
110    /// <p>The list of member accounts that Detective was not able to delete from the behavior graph. For each member account, provides the reason that the deletion could not be processed.</p>
111    #[serde(rename = "UnprocessedAccounts")]
112    #[serde(skip_serializing_if = "Option::is_none")]
113    pub unprocessed_accounts: Option<Vec<UnprocessedAccount>>,
114}
115
116#[derive(Clone, Debug, Default, PartialEq, Serialize)]
117#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
118pub struct DisassociateMembershipRequest {
119    /// <p>The ARN of the behavior graph to remove the member account from.</p> <p>The member account's member status in the behavior graph must be <code>ENABLED</code>.</p>
120    #[serde(rename = "GraphArn")]
121    pub graph_arn: String,
122}
123
124#[derive(Clone, Debug, Default, PartialEq, Serialize)]
125#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
126pub struct GetMembersRequest {
127    /// <p>The list of AWS account identifiers for the member account for which to return member details.</p> <p>You cannot use <code>GetMembers</code> to retrieve information about member accounts that were removed from the behavior graph.</p>
128    #[serde(rename = "AccountIds")]
129    pub account_ids: Vec<String>,
130    /// <p>The ARN of the behavior graph for which to request the member details.</p>
131    #[serde(rename = "GraphArn")]
132    pub graph_arn: String,
133}
134
135#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
136#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
137pub struct GetMembersResponse {
138    /// <p>The member account details that Detective is returning in response to the request.</p>
139    #[serde(rename = "MemberDetails")]
140    #[serde(skip_serializing_if = "Option::is_none")]
141    pub member_details: Option<Vec<MemberDetail>>,
142    /// <p>The requested member accounts for which Detective was unable to return member details.</p> <p>For each account, provides the reason why the request could not be processed.</p>
143    #[serde(rename = "UnprocessedAccounts")]
144    #[serde(skip_serializing_if = "Option::is_none")]
145    pub unprocessed_accounts: Option<Vec<UnprocessedAccount>>,
146}
147
148/// <p>A behavior graph in Detective.</p>
149#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
150#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
151pub struct Graph {
152    /// <p>The ARN of the behavior graph.</p>
153    #[serde(rename = "Arn")]
154    #[serde(skip_serializing_if = "Option::is_none")]
155    pub arn: Option<String>,
156    /// <p>The date and time that the behavior graph was created. The value is in milliseconds since the epoch.</p>
157    #[serde(rename = "CreatedTime")]
158    #[serde(skip_serializing_if = "Option::is_none")]
159    pub created_time: Option<f64>,
160}
161
162#[derive(Clone, Debug, Default, PartialEq, Serialize)]
163#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
164pub struct ListGraphsRequest {
165    /// <p>The maximum number of graphs to return at a time. The total must be less than the overall limit on the number of results to return, which is currently 200.</p>
166    #[serde(rename = "MaxResults")]
167    #[serde(skip_serializing_if = "Option::is_none")]
168    pub max_results: Option<i64>,
169    /// <p>For requests to get the next page of results, the pagination token that was returned with the previous set of results. The initial request does not include a pagination token.</p>
170    #[serde(rename = "NextToken")]
171    #[serde(skip_serializing_if = "Option::is_none")]
172    pub next_token: Option<String>,
173}
174
175#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
176#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
177pub struct ListGraphsResponse {
178    /// <p>A list of behavior graphs that the account is a master for.</p>
179    #[serde(rename = "GraphList")]
180    #[serde(skip_serializing_if = "Option::is_none")]
181    pub graph_list: Option<Vec<Graph>>,
182    /// <p>If there are more behavior graphs remaining in the results, then this is the pagination token to use to request the next page of behavior graphs.</p>
183    #[serde(rename = "NextToken")]
184    #[serde(skip_serializing_if = "Option::is_none")]
185    pub next_token: Option<String>,
186}
187
188#[derive(Clone, Debug, Default, PartialEq, Serialize)]
189#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
190pub struct ListInvitationsRequest {
191    /// <p>The maximum number of behavior graph invitations to return in the response. The total must be less than the overall limit on the number of results to return, which is currently 200.</p>
192    #[serde(rename = "MaxResults")]
193    #[serde(skip_serializing_if = "Option::is_none")]
194    pub max_results: Option<i64>,
195    /// <p>For requests to retrieve the next page of results, the pagination token that was returned with the previous page of results. The initial request does not include a pagination token.</p>
196    #[serde(rename = "NextToken")]
197    #[serde(skip_serializing_if = "Option::is_none")]
198    pub next_token: Option<String>,
199}
200
201#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
202#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
203pub struct ListInvitationsResponse {
204    /// <p>The list of behavior graphs for which the member account has open or accepted invitations.</p>
205    #[serde(rename = "Invitations")]
206    #[serde(skip_serializing_if = "Option::is_none")]
207    pub invitations: Option<Vec<MemberDetail>>,
208    /// <p>If there are more behavior graphs remaining in the results, then this is the pagination token to use to request the next page of behavior graphs.</p>
209    #[serde(rename = "NextToken")]
210    #[serde(skip_serializing_if = "Option::is_none")]
211    pub next_token: Option<String>,
212}
213
214#[derive(Clone, Debug, Default, PartialEq, Serialize)]
215#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
216pub struct ListMembersRequest {
217    /// <p>The ARN of the behavior graph for which to retrieve the list of member accounts.</p>
218    #[serde(rename = "GraphArn")]
219    pub graph_arn: String,
220    /// <p>The maximum number of member accounts to include in the response. The total must be less than the overall limit on the number of results to return, which is currently 200.</p>
221    #[serde(rename = "MaxResults")]
222    #[serde(skip_serializing_if = "Option::is_none")]
223    pub max_results: Option<i64>,
224    /// <p>For requests to retrieve the next page of member account results, the pagination token that was returned with the previous page of results. The initial request does not include a pagination token.</p>
225    #[serde(rename = "NextToken")]
226    #[serde(skip_serializing_if = "Option::is_none")]
227    pub next_token: Option<String>,
228}
229
230#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
231#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
232pub struct ListMembersResponse {
233    /// <p>The list of member accounts in the behavior graph.</p> <p>The results include member accounts that did not pass verification and member accounts that have not yet accepted the invitation to the behavior graph. The results do not include member accounts that were removed from the behavior graph.</p>
234    #[serde(rename = "MemberDetails")]
235    #[serde(skip_serializing_if = "Option::is_none")]
236    pub member_details: Option<Vec<MemberDetail>>,
237    /// <p>If there are more member accounts remaining in the results, then this is the pagination token to use to request the next page of member accounts.</p>
238    #[serde(rename = "NextToken")]
239    #[serde(skip_serializing_if = "Option::is_none")]
240    pub next_token: Option<String>,
241}
242
243/// <p>Details about a member account that was invited to contribute to a behavior graph.</p>
244#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
245#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
246pub struct MemberDetail {
247    /// <p>The AWS account identifier for the member account.</p>
248    #[serde(rename = "AccountId")]
249    #[serde(skip_serializing_if = "Option::is_none")]
250    pub account_id: Option<String>,
251    /// <p><p>For member accounts with a status of <code>ACCEPTED<em>BUT</em>DISABLED</code>, the reason that the member account is not enabled.</p> <p>The reason can have one of the following values:</p> <ul> <li> <p> <code>VOLUME<em>TOO</em>HIGH</code> - Indicates that adding the member account would cause the data volume for the behavior graph to be too high.</p> </li> <li> <p> <code>VOLUME_UNKNOWN</code> - Indicates that Detective is unable to verify the data volume for the member account. This is usually because the member account is not enrolled in Amazon GuardDuty. </p> </li> </ul></p>
252    #[serde(rename = "DisabledReason")]
253    #[serde(skip_serializing_if = "Option::is_none")]
254    pub disabled_reason: Option<String>,
255    /// <p>The AWS account root user email address for the member account.</p>
256    #[serde(rename = "EmailAddress")]
257    #[serde(skip_serializing_if = "Option::is_none")]
258    pub email_address: Option<String>,
259    /// <p>The ARN of the behavior graph that the member account was invited to.</p>
260    #[serde(rename = "GraphArn")]
261    #[serde(skip_serializing_if = "Option::is_none")]
262    pub graph_arn: Option<String>,
263    /// <p>The date and time that Detective sent the invitation to the member account. The value is in milliseconds since the epoch.</p>
264    #[serde(rename = "InvitedTime")]
265    #[serde(skip_serializing_if = "Option::is_none")]
266    pub invited_time: Option<f64>,
267    /// <p>The AWS account identifier of the master account for the behavior graph.</p>
268    #[serde(rename = "MasterId")]
269    #[serde(skip_serializing_if = "Option::is_none")]
270    pub master_id: Option<String>,
271    /// <p>The member account data volume as a percentage of the maximum allowed data volume. 0 indicates 0 percent, and 100 indicates 100 percent.</p> <p>Note that this is not the percentage of the behavior graph data volume.</p> <p>For example, the data volume for the behavior graph is 80 GB per day. The maximum data volume is 160 GB per day. If the data volume for the member account is 40 GB per day, then <code>PercentOfGraphUtilization</code> is 25. It represents 25% of the maximum allowed data volume. </p>
272    #[serde(rename = "PercentOfGraphUtilization")]
273    #[serde(skip_serializing_if = "Option::is_none")]
274    pub percent_of_graph_utilization: Option<f64>,
275    /// <p>The date and time when the graph utilization percentage was last updated.</p>
276    #[serde(rename = "PercentOfGraphUtilizationUpdatedTime")]
277    #[serde(skip_serializing_if = "Option::is_none")]
278    pub percent_of_graph_utilization_updated_time: Option<f64>,
279    /// <p>The current membership status of the member account. The status can have one of the following values:</p> <ul> <li> <p> <code>INVITED</code> - Indicates that the member was sent an invitation but has not yet responded.</p> </li> <li> <p> <code>VERIFICATION_IN_PROGRESS</code> - Indicates that Detective is verifying that the account identifier and email address provided for the member account match. If they do match, then Detective sends the invitation. If the email address and account identifier don't match, then the member cannot be added to the behavior graph.</p> </li> <li> <p> <code>VERIFICATION_FAILED</code> - Indicates that the account and email address provided for the member account do not match, and Detective did not send an invitation to the account.</p> </li> <li> <p> <code>ENABLED</code> - Indicates that the member account accepted the invitation to contribute to the behavior graph.</p> </li> <li> <p> <code>ACCEPTED_BUT_DISABLED</code> - Indicates that the member account accepted the invitation but is prevented from contributing data to the behavior graph. <code>DisabledReason</code> provides the reason why the member account is not enabled.</p> </li> </ul> <p>Member accounts that declined an invitation or that were removed from the behavior graph are not included.</p>
280    #[serde(rename = "Status")]
281    #[serde(skip_serializing_if = "Option::is_none")]
282    pub status: Option<String>,
283    /// <p>The date and time that the member account was last updated. The value is in milliseconds since the epoch.</p>
284    #[serde(rename = "UpdatedTime")]
285    #[serde(skip_serializing_if = "Option::is_none")]
286    pub updated_time: Option<f64>,
287}
288
289#[derive(Clone, Debug, Default, PartialEq, Serialize)]
290#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
291pub struct RejectInvitationRequest {
292    /// <p>The ARN of the behavior graph to reject the invitation to.</p> <p>The member account's current member status in the behavior graph must be <code>INVITED</code>.</p>
293    #[serde(rename = "GraphArn")]
294    pub graph_arn: String,
295}
296
297#[derive(Clone, Debug, Default, PartialEq, Serialize)]
298#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
299pub struct StartMonitoringMemberRequest {
300    /// <p>The account ID of the member account to try to enable.</p> <p>The account must be an invited member account with a status of <code>ACCEPTED_BUT_DISABLED</code>. </p>
301    #[serde(rename = "AccountId")]
302    pub account_id: String,
303    /// <p>The ARN of the behavior graph.</p>
304    #[serde(rename = "GraphArn")]
305    pub graph_arn: String,
306}
307
308/// <p>A member account that was included in a request but for which the request could not be processed.</p>
309#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
310#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
311pub struct UnprocessedAccount {
312    /// <p>The AWS account identifier of the member account that was not processed.</p>
313    #[serde(rename = "AccountId")]
314    #[serde(skip_serializing_if = "Option::is_none")]
315    pub account_id: Option<String>,
316    /// <p>The reason that the member account request could not be processed.</p>
317    #[serde(rename = "Reason")]
318    #[serde(skip_serializing_if = "Option::is_none")]
319    pub reason: Option<String>,
320}
321
322/// Errors returned by AcceptInvitation
323#[derive(Debug, PartialEq)]
324pub enum AcceptInvitationError {
325    /// <p>The request attempted an invalid action.</p>
326    Conflict(String),
327    /// <p>The request was valid but failed because of a problem with the service.</p>
328    InternalServer(String),
329    /// <p>The request refers to a nonexistent resource.</p>
330    ResourceNotFound(String),
331}
332
333impl AcceptInvitationError {
334    pub fn from_response(res: BufferedHttpResponse) -> RusotoError<AcceptInvitationError> {
335        if let Some(err) = proto::json::Error::parse_rest(&res) {
336            match err.typ.as_str() {
337                "ConflictException" => {
338                    return RusotoError::Service(AcceptInvitationError::Conflict(err.msg))
339                }
340                "InternalServerException" => {
341                    return RusotoError::Service(AcceptInvitationError::InternalServer(err.msg))
342                }
343                "ResourceNotFoundException" => {
344                    return RusotoError::Service(AcceptInvitationError::ResourceNotFound(err.msg))
345                }
346                "ValidationException" => return RusotoError::Validation(err.msg),
347                _ => {}
348            }
349        }
350        RusotoError::Unknown(res)
351    }
352}
353impl fmt::Display for AcceptInvitationError {
354    #[allow(unused_variables)]
355    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
356        match *self {
357            AcceptInvitationError::Conflict(ref cause) => write!(f, "{}", cause),
358            AcceptInvitationError::InternalServer(ref cause) => write!(f, "{}", cause),
359            AcceptInvitationError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
360        }
361    }
362}
363impl Error for AcceptInvitationError {}
364/// Errors returned by CreateGraph
365#[derive(Debug, PartialEq)]
366pub enum CreateGraphError {
367    /// <p>The request attempted an invalid action.</p>
368    Conflict(String),
369    /// <p>The request was valid but failed because of a problem with the service.</p>
370    InternalServer(String),
371    /// <p><p>This request cannot be completed for one of the following reasons.</p> <ul> <li> <p>The request would cause the number of member accounts in the behavior graph to exceed the maximum allowed. A behavior graph cannot have more than 1000 member accounts.</p> </li> <li> <p>The request would cause the data rate for the behavior graph to exceed the maximum allowed.</p> </li> <li> <p>Detective is unable to verify the data rate for the member account. This is usually because the member account is not enrolled in Amazon GuardDuty. </p> </li> </ul></p>
372    ServiceQuotaExceeded(String),
373}
374
375impl CreateGraphError {
376    pub fn from_response(res: BufferedHttpResponse) -> RusotoError<CreateGraphError> {
377        if let Some(err) = proto::json::Error::parse_rest(&res) {
378            match err.typ.as_str() {
379                "ConflictException" => {
380                    return RusotoError::Service(CreateGraphError::Conflict(err.msg))
381                }
382                "InternalServerException" => {
383                    return RusotoError::Service(CreateGraphError::InternalServer(err.msg))
384                }
385                "ServiceQuotaExceededException" => {
386                    return RusotoError::Service(CreateGraphError::ServiceQuotaExceeded(err.msg))
387                }
388                "ValidationException" => return RusotoError::Validation(err.msg),
389                _ => {}
390            }
391        }
392        RusotoError::Unknown(res)
393    }
394}
395impl fmt::Display for CreateGraphError {
396    #[allow(unused_variables)]
397    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
398        match *self {
399            CreateGraphError::Conflict(ref cause) => write!(f, "{}", cause),
400            CreateGraphError::InternalServer(ref cause) => write!(f, "{}", cause),
401            CreateGraphError::ServiceQuotaExceeded(ref cause) => write!(f, "{}", cause),
402        }
403    }
404}
405impl Error for CreateGraphError {}
406/// Errors returned by CreateMembers
407#[derive(Debug, PartialEq)]
408pub enum CreateMembersError {
409    /// <p>The request was valid but failed because of a problem with the service.</p>
410    InternalServer(String),
411    /// <p>The request refers to a nonexistent resource.</p>
412    ResourceNotFound(String),
413    /// <p><p>This request cannot be completed for one of the following reasons.</p> <ul> <li> <p>The request would cause the number of member accounts in the behavior graph to exceed the maximum allowed. A behavior graph cannot have more than 1000 member accounts.</p> </li> <li> <p>The request would cause the data rate for the behavior graph to exceed the maximum allowed.</p> </li> <li> <p>Detective is unable to verify the data rate for the member account. This is usually because the member account is not enrolled in Amazon GuardDuty. </p> </li> </ul></p>
414    ServiceQuotaExceeded(String),
415}
416
417impl CreateMembersError {
418    pub fn from_response(res: BufferedHttpResponse) -> RusotoError<CreateMembersError> {
419        if let Some(err) = proto::json::Error::parse_rest(&res) {
420            match err.typ.as_str() {
421                "InternalServerException" => {
422                    return RusotoError::Service(CreateMembersError::InternalServer(err.msg))
423                }
424                "ResourceNotFoundException" => {
425                    return RusotoError::Service(CreateMembersError::ResourceNotFound(err.msg))
426                }
427                "ServiceQuotaExceededException" => {
428                    return RusotoError::Service(CreateMembersError::ServiceQuotaExceeded(err.msg))
429                }
430                "ValidationException" => return RusotoError::Validation(err.msg),
431                _ => {}
432            }
433        }
434        RusotoError::Unknown(res)
435    }
436}
437impl fmt::Display for CreateMembersError {
438    #[allow(unused_variables)]
439    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
440        match *self {
441            CreateMembersError::InternalServer(ref cause) => write!(f, "{}", cause),
442            CreateMembersError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
443            CreateMembersError::ServiceQuotaExceeded(ref cause) => write!(f, "{}", cause),
444        }
445    }
446}
447impl Error for CreateMembersError {}
448/// Errors returned by DeleteGraph
449#[derive(Debug, PartialEq)]
450pub enum DeleteGraphError {
451    /// <p>The request was valid but failed because of a problem with the service.</p>
452    InternalServer(String),
453    /// <p>The request refers to a nonexistent resource.</p>
454    ResourceNotFound(String),
455}
456
457impl DeleteGraphError {
458    pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DeleteGraphError> {
459        if let Some(err) = proto::json::Error::parse_rest(&res) {
460            match err.typ.as_str() {
461                "InternalServerException" => {
462                    return RusotoError::Service(DeleteGraphError::InternalServer(err.msg))
463                }
464                "ResourceNotFoundException" => {
465                    return RusotoError::Service(DeleteGraphError::ResourceNotFound(err.msg))
466                }
467                "ValidationException" => return RusotoError::Validation(err.msg),
468                _ => {}
469            }
470        }
471        RusotoError::Unknown(res)
472    }
473}
474impl fmt::Display for DeleteGraphError {
475    #[allow(unused_variables)]
476    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
477        match *self {
478            DeleteGraphError::InternalServer(ref cause) => write!(f, "{}", cause),
479            DeleteGraphError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
480        }
481    }
482}
483impl Error for DeleteGraphError {}
484/// Errors returned by DeleteMembers
485#[derive(Debug, PartialEq)]
486pub enum DeleteMembersError {
487    /// <p>The request attempted an invalid action.</p>
488    Conflict(String),
489    /// <p>The request was valid but failed because of a problem with the service.</p>
490    InternalServer(String),
491    /// <p>The request refers to a nonexistent resource.</p>
492    ResourceNotFound(String),
493}
494
495impl DeleteMembersError {
496    pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DeleteMembersError> {
497        if let Some(err) = proto::json::Error::parse_rest(&res) {
498            match err.typ.as_str() {
499                "ConflictException" => {
500                    return RusotoError::Service(DeleteMembersError::Conflict(err.msg))
501                }
502                "InternalServerException" => {
503                    return RusotoError::Service(DeleteMembersError::InternalServer(err.msg))
504                }
505                "ResourceNotFoundException" => {
506                    return RusotoError::Service(DeleteMembersError::ResourceNotFound(err.msg))
507                }
508                "ValidationException" => return RusotoError::Validation(err.msg),
509                _ => {}
510            }
511        }
512        RusotoError::Unknown(res)
513    }
514}
515impl fmt::Display for DeleteMembersError {
516    #[allow(unused_variables)]
517    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
518        match *self {
519            DeleteMembersError::Conflict(ref cause) => write!(f, "{}", cause),
520            DeleteMembersError::InternalServer(ref cause) => write!(f, "{}", cause),
521            DeleteMembersError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
522        }
523    }
524}
525impl Error for DeleteMembersError {}
526/// Errors returned by DisassociateMembership
527#[derive(Debug, PartialEq)]
528pub enum DisassociateMembershipError {
529    /// <p>The request attempted an invalid action.</p>
530    Conflict(String),
531    /// <p>The request was valid but failed because of a problem with the service.</p>
532    InternalServer(String),
533    /// <p>The request refers to a nonexistent resource.</p>
534    ResourceNotFound(String),
535}
536
537impl DisassociateMembershipError {
538    pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DisassociateMembershipError> {
539        if let Some(err) = proto::json::Error::parse_rest(&res) {
540            match err.typ.as_str() {
541                "ConflictException" => {
542                    return RusotoError::Service(DisassociateMembershipError::Conflict(err.msg))
543                }
544                "InternalServerException" => {
545                    return RusotoError::Service(DisassociateMembershipError::InternalServer(
546                        err.msg,
547                    ))
548                }
549                "ResourceNotFoundException" => {
550                    return RusotoError::Service(DisassociateMembershipError::ResourceNotFound(
551                        err.msg,
552                    ))
553                }
554                "ValidationException" => return RusotoError::Validation(err.msg),
555                _ => {}
556            }
557        }
558        RusotoError::Unknown(res)
559    }
560}
561impl fmt::Display for DisassociateMembershipError {
562    #[allow(unused_variables)]
563    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
564        match *self {
565            DisassociateMembershipError::Conflict(ref cause) => write!(f, "{}", cause),
566            DisassociateMembershipError::InternalServer(ref cause) => write!(f, "{}", cause),
567            DisassociateMembershipError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
568        }
569    }
570}
571impl Error for DisassociateMembershipError {}
572/// Errors returned by GetMembers
573#[derive(Debug, PartialEq)]
574pub enum GetMembersError {
575    /// <p>The request was valid but failed because of a problem with the service.</p>
576    InternalServer(String),
577    /// <p>The request refers to a nonexistent resource.</p>
578    ResourceNotFound(String),
579}
580
581impl GetMembersError {
582    pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetMembersError> {
583        if let Some(err) = proto::json::Error::parse_rest(&res) {
584            match err.typ.as_str() {
585                "InternalServerException" => {
586                    return RusotoError::Service(GetMembersError::InternalServer(err.msg))
587                }
588                "ResourceNotFoundException" => {
589                    return RusotoError::Service(GetMembersError::ResourceNotFound(err.msg))
590                }
591                "ValidationException" => return RusotoError::Validation(err.msg),
592                _ => {}
593            }
594        }
595        RusotoError::Unknown(res)
596    }
597}
598impl fmt::Display for GetMembersError {
599    #[allow(unused_variables)]
600    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
601        match *self {
602            GetMembersError::InternalServer(ref cause) => write!(f, "{}", cause),
603            GetMembersError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
604        }
605    }
606}
607impl Error for GetMembersError {}
608/// Errors returned by ListGraphs
609#[derive(Debug, PartialEq)]
610pub enum ListGraphsError {
611    /// <p>The request was valid but failed because of a problem with the service.</p>
612    InternalServer(String),
613}
614
615impl ListGraphsError {
616    pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListGraphsError> {
617        if let Some(err) = proto::json::Error::parse_rest(&res) {
618            match err.typ.as_str() {
619                "InternalServerException" => {
620                    return RusotoError::Service(ListGraphsError::InternalServer(err.msg))
621                }
622                "ValidationException" => return RusotoError::Validation(err.msg),
623                _ => {}
624            }
625        }
626        RusotoError::Unknown(res)
627    }
628}
629impl fmt::Display for ListGraphsError {
630    #[allow(unused_variables)]
631    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
632        match *self {
633            ListGraphsError::InternalServer(ref cause) => write!(f, "{}", cause),
634        }
635    }
636}
637impl Error for ListGraphsError {}
638/// Errors returned by ListInvitations
639#[derive(Debug, PartialEq)]
640pub enum ListInvitationsError {
641    /// <p>The request was valid but failed because of a problem with the service.</p>
642    InternalServer(String),
643}
644
645impl ListInvitationsError {
646    pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListInvitationsError> {
647        if let Some(err) = proto::json::Error::parse_rest(&res) {
648            match err.typ.as_str() {
649                "InternalServerException" => {
650                    return RusotoError::Service(ListInvitationsError::InternalServer(err.msg))
651                }
652                "ValidationException" => return RusotoError::Validation(err.msg),
653                _ => {}
654            }
655        }
656        RusotoError::Unknown(res)
657    }
658}
659impl fmt::Display for ListInvitationsError {
660    #[allow(unused_variables)]
661    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
662        match *self {
663            ListInvitationsError::InternalServer(ref cause) => write!(f, "{}", cause),
664        }
665    }
666}
667impl Error for ListInvitationsError {}
668/// Errors returned by ListMembers
669#[derive(Debug, PartialEq)]
670pub enum ListMembersError {
671    /// <p>The request was valid but failed because of a problem with the service.</p>
672    InternalServer(String),
673    /// <p>The request refers to a nonexistent resource.</p>
674    ResourceNotFound(String),
675}
676
677impl ListMembersError {
678    pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListMembersError> {
679        if let Some(err) = proto::json::Error::parse_rest(&res) {
680            match err.typ.as_str() {
681                "InternalServerException" => {
682                    return RusotoError::Service(ListMembersError::InternalServer(err.msg))
683                }
684                "ResourceNotFoundException" => {
685                    return RusotoError::Service(ListMembersError::ResourceNotFound(err.msg))
686                }
687                "ValidationException" => return RusotoError::Validation(err.msg),
688                _ => {}
689            }
690        }
691        RusotoError::Unknown(res)
692    }
693}
694impl fmt::Display for ListMembersError {
695    #[allow(unused_variables)]
696    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
697        match *self {
698            ListMembersError::InternalServer(ref cause) => write!(f, "{}", cause),
699            ListMembersError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
700        }
701    }
702}
703impl Error for ListMembersError {}
704/// Errors returned by RejectInvitation
705#[derive(Debug, PartialEq)]
706pub enum RejectInvitationError {
707    /// <p>The request attempted an invalid action.</p>
708    Conflict(String),
709    /// <p>The request was valid but failed because of a problem with the service.</p>
710    InternalServer(String),
711    /// <p>The request refers to a nonexistent resource.</p>
712    ResourceNotFound(String),
713}
714
715impl RejectInvitationError {
716    pub fn from_response(res: BufferedHttpResponse) -> RusotoError<RejectInvitationError> {
717        if let Some(err) = proto::json::Error::parse_rest(&res) {
718            match err.typ.as_str() {
719                "ConflictException" => {
720                    return RusotoError::Service(RejectInvitationError::Conflict(err.msg))
721                }
722                "InternalServerException" => {
723                    return RusotoError::Service(RejectInvitationError::InternalServer(err.msg))
724                }
725                "ResourceNotFoundException" => {
726                    return RusotoError::Service(RejectInvitationError::ResourceNotFound(err.msg))
727                }
728                "ValidationException" => return RusotoError::Validation(err.msg),
729                _ => {}
730            }
731        }
732        RusotoError::Unknown(res)
733    }
734}
735impl fmt::Display for RejectInvitationError {
736    #[allow(unused_variables)]
737    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
738        match *self {
739            RejectInvitationError::Conflict(ref cause) => write!(f, "{}", cause),
740            RejectInvitationError::InternalServer(ref cause) => write!(f, "{}", cause),
741            RejectInvitationError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
742        }
743    }
744}
745impl Error for RejectInvitationError {}
746/// Errors returned by StartMonitoringMember
747#[derive(Debug, PartialEq)]
748pub enum StartMonitoringMemberError {
749    /// <p>The request attempted an invalid action.</p>
750    Conflict(String),
751    /// <p>The request was valid but failed because of a problem with the service.</p>
752    InternalServer(String),
753    /// <p>The request refers to a nonexistent resource.</p>
754    ResourceNotFound(String),
755    /// <p><p>This request cannot be completed for one of the following reasons.</p> <ul> <li> <p>The request would cause the number of member accounts in the behavior graph to exceed the maximum allowed. A behavior graph cannot have more than 1000 member accounts.</p> </li> <li> <p>The request would cause the data rate for the behavior graph to exceed the maximum allowed.</p> </li> <li> <p>Detective is unable to verify the data rate for the member account. This is usually because the member account is not enrolled in Amazon GuardDuty. </p> </li> </ul></p>
756    ServiceQuotaExceeded(String),
757}
758
759impl StartMonitoringMemberError {
760    pub fn from_response(res: BufferedHttpResponse) -> RusotoError<StartMonitoringMemberError> {
761        if let Some(err) = proto::json::Error::parse_rest(&res) {
762            match err.typ.as_str() {
763                "ConflictException" => {
764                    return RusotoError::Service(StartMonitoringMemberError::Conflict(err.msg))
765                }
766                "InternalServerException" => {
767                    return RusotoError::Service(StartMonitoringMemberError::InternalServer(
768                        err.msg,
769                    ))
770                }
771                "ResourceNotFoundException" => {
772                    return RusotoError::Service(StartMonitoringMemberError::ResourceNotFound(
773                        err.msg,
774                    ))
775                }
776                "ServiceQuotaExceededException" => {
777                    return RusotoError::Service(StartMonitoringMemberError::ServiceQuotaExceeded(
778                        err.msg,
779                    ))
780                }
781                "ValidationException" => return RusotoError::Validation(err.msg),
782                _ => {}
783            }
784        }
785        RusotoError::Unknown(res)
786    }
787}
788impl fmt::Display for StartMonitoringMemberError {
789    #[allow(unused_variables)]
790    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
791        match *self {
792            StartMonitoringMemberError::Conflict(ref cause) => write!(f, "{}", cause),
793            StartMonitoringMemberError::InternalServer(ref cause) => write!(f, "{}", cause),
794            StartMonitoringMemberError::ResourceNotFound(ref cause) => write!(f, "{}", cause),
795            StartMonitoringMemberError::ServiceQuotaExceeded(ref cause) => write!(f, "{}", cause),
796        }
797    }
798}
799impl Error for StartMonitoringMemberError {}
800/// Trait representing the capabilities of the Amazon Detective API. Amazon Detective clients implement this trait.
801#[async_trait]
802pub trait Detective {
803    /// <p>Accepts an invitation for the member account to contribute data to a behavior graph. This operation can only be called by an invited member account. </p> <p>The request provides the ARN of behavior graph.</p> <p>The member account status in the graph must be <code>INVITED</code>.</p>
804    async fn accept_invitation(
805        &self,
806        input: AcceptInvitationRequest,
807    ) -> Result<(), RusotoError<AcceptInvitationError>>;
808
809    /// <p>Creates a new behavior graph for the calling account, and sets that account as the master account. This operation is called by the account that is enabling Detective.</p> <p>Before you try to enable Detective, make sure that your account has been enrolled in Amazon GuardDuty for at least 48 hours. If you do not meet this requirement, you cannot enable Detective. If you do meet the GuardDuty prerequisite, then when you make the request to enable Detective, it checks whether your data volume is within the Detective quota. If it exceeds the quota, then you cannot enable Detective. </p> <p>The operation also enables Detective for the calling account in the currently selected Region. It returns the ARN of the new behavior graph.</p> <p> <code>CreateGraph</code> triggers a process to create the corresponding data tables for the new behavior graph.</p> <p>An account can only be the master account for one behavior graph within a Region. If the same account calls <code>CreateGraph</code> with the same master account, it always returns the same behavior graph ARN. It does not create a new behavior graph.</p>
810    async fn create_graph(&self) -> Result<CreateGraphResponse, RusotoError<CreateGraphError>>;
811
812    /// <p><p>Sends a request to invite the specified AWS accounts to be member accounts in the behavior graph. This operation can only be called by the master account for a behavior graph. </p> <p> <code>CreateMembers</code> verifies the accounts and then sends invitations to the verified accounts.</p> <p>The request provides the behavior graph ARN and the list of accounts to invite.</p> <p>The response separates the requested accounts into two lists:</p> <ul> <li> <p>The accounts that <code>CreateMembers</code> was able to start the verification for. This list includes member accounts that are being verified, that have passed verification and are being sent an invitation, and that have failed verification.</p> </li> <li> <p>The accounts that <code>CreateMembers</code> was unable to process. This list includes accounts that were already invited to be member accounts in the behavior graph.</p> </li> </ul></p>
813    async fn create_members(
814        &self,
815        input: CreateMembersRequest,
816    ) -> Result<CreateMembersResponse, RusotoError<CreateMembersError>>;
817
818    /// <p>Disables the specified behavior graph and queues it to be deleted. This operation removes the graph from each member account's list of behavior graphs.</p> <p> <code>DeleteGraph</code> can only be called by the master account for a behavior graph.</p>
819    async fn delete_graph(
820        &self,
821        input: DeleteGraphRequest,
822    ) -> Result<(), RusotoError<DeleteGraphError>>;
823
824    /// <p>Deletes one or more member accounts from the master account behavior graph. This operation can only be called by a Detective master account. That account cannot use <code>DeleteMembers</code> to delete their own account from the behavior graph. To disable a behavior graph, the master account uses the <code>DeleteGraph</code> API method.</p>
825    async fn delete_members(
826        &self,
827        input: DeleteMembersRequest,
828    ) -> Result<DeleteMembersResponse, RusotoError<DeleteMembersError>>;
829
830    /// <p>Removes the member account from the specified behavior graph. This operation can only be called by a member account that has the <code>ENABLED</code> status.</p>
831    async fn disassociate_membership(
832        &self,
833        input: DisassociateMembershipRequest,
834    ) -> Result<(), RusotoError<DisassociateMembershipError>>;
835
836    /// <p>Returns the membership details for specified member accounts for a behavior graph.</p>
837    async fn get_members(
838        &self,
839        input: GetMembersRequest,
840    ) -> Result<GetMembersResponse, RusotoError<GetMembersError>>;
841
842    /// <p>Returns the list of behavior graphs that the calling account is a master of. This operation can only be called by a master account.</p> <p>Because an account can currently only be the master of one behavior graph within a Region, the results always contain a single graph.</p>
843    async fn list_graphs(
844        &self,
845        input: ListGraphsRequest,
846    ) -> Result<ListGraphsResponse, RusotoError<ListGraphsError>>;
847
848    /// <p>Retrieves the list of open and accepted behavior graph invitations for the member account. This operation can only be called by a member account.</p> <p>Open invitations are invitations that the member account has not responded to.</p> <p>The results do not include behavior graphs for which the member account declined the invitation. The results also do not include behavior graphs that the member account resigned from or was removed from.</p>
849    async fn list_invitations(
850        &self,
851        input: ListInvitationsRequest,
852    ) -> Result<ListInvitationsResponse, RusotoError<ListInvitationsError>>;
853
854    /// <p>Retrieves the list of member accounts for a behavior graph. Does not return member accounts that were removed from the behavior graph.</p>
855    async fn list_members(
856        &self,
857        input: ListMembersRequest,
858    ) -> Result<ListMembersResponse, RusotoError<ListMembersError>>;
859
860    /// <p>Rejects an invitation to contribute the account data to a behavior graph. This operation must be called by a member account that has the <code>INVITED</code> status.</p>
861    async fn reject_invitation(
862        &self,
863        input: RejectInvitationRequest,
864    ) -> Result<(), RusotoError<RejectInvitationError>>;
865
866    /// <p><p>Sends a request to enable data ingest for a member account that has a status of <code>ACCEPTED<em>BUT</em>DISABLED</code>.</p> <p>For valid member accounts, the status is updated as follows.</p> <ul> <li> <p>If Detective enabled the member account, then the new status is <code>ENABLED</code>.</p> </li> <li> <p>If Detective cannot enable the member account, the status remains <code>ACCEPTED<em>BUT</em>DISABLED</code>. </p> </li> </ul></p>
867    async fn start_monitoring_member(
868        &self,
869        input: StartMonitoringMemberRequest,
870    ) -> Result<(), RusotoError<StartMonitoringMemberError>>;
871}
872/// A client for the Amazon Detective API.
873#[derive(Clone)]
874pub struct DetectiveClient {
875    client: Client,
876    region: region::Region,
877}
878
879impl DetectiveClient {
880    /// Creates a client backed by the default tokio event loop.
881    ///
882    /// The client will use the default credentials provider and tls client.
883    pub fn new(region: region::Region) -> DetectiveClient {
884        DetectiveClient {
885            client: Client::shared(),
886            region,
887        }
888    }
889
890    pub fn new_with<P, D>(
891        request_dispatcher: D,
892        credentials_provider: P,
893        region: region::Region,
894    ) -> DetectiveClient
895    where
896        P: ProvideAwsCredentials + Send + Sync + 'static,
897        D: DispatchSignedRequest + Send + Sync + 'static,
898    {
899        DetectiveClient {
900            client: Client::new_with(credentials_provider, request_dispatcher),
901            region,
902        }
903    }
904
905    pub fn new_with_client(client: Client, region: region::Region) -> DetectiveClient {
906        DetectiveClient { client, region }
907    }
908}
909
910#[async_trait]
911impl Detective for DetectiveClient {
912    /// <p>Accepts an invitation for the member account to contribute data to a behavior graph. This operation can only be called by an invited member account. </p> <p>The request provides the ARN of behavior graph.</p> <p>The member account status in the graph must be <code>INVITED</code>.</p>
913    #[allow(unused_mut)]
914    async fn accept_invitation(
915        &self,
916        input: AcceptInvitationRequest,
917    ) -> Result<(), RusotoError<AcceptInvitationError>> {
918        let request_uri = "/invitation";
919
920        let mut request = SignedRequest::new("PUT", "detective", &self.region, &request_uri);
921        request.set_content_type("application/x-amz-json-1.1".to_owned());
922
923        request.set_endpoint_prefix("api.detective".to_string());
924        let encoded = Some(serde_json::to_vec(&input).unwrap());
925        request.set_payload(encoded);
926
927        let mut response = self
928            .client
929            .sign_and_dispatch(request)
930            .await
931            .map_err(RusotoError::from)?;
932        if response.status.is_success() {
933            let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
934            let result = ::std::mem::drop(response);
935
936            Ok(result)
937        } else {
938            let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
939            Err(AcceptInvitationError::from_response(response))
940        }
941    }
942
943    /// <p>Creates a new behavior graph for the calling account, and sets that account as the master account. This operation is called by the account that is enabling Detective.</p> <p>Before you try to enable Detective, make sure that your account has been enrolled in Amazon GuardDuty for at least 48 hours. If you do not meet this requirement, you cannot enable Detective. If you do meet the GuardDuty prerequisite, then when you make the request to enable Detective, it checks whether your data volume is within the Detective quota. If it exceeds the quota, then you cannot enable Detective. </p> <p>The operation also enables Detective for the calling account in the currently selected Region. It returns the ARN of the new behavior graph.</p> <p> <code>CreateGraph</code> triggers a process to create the corresponding data tables for the new behavior graph.</p> <p>An account can only be the master account for one behavior graph within a Region. If the same account calls <code>CreateGraph</code> with the same master account, it always returns the same behavior graph ARN. It does not create a new behavior graph.</p>
944    #[allow(unused_mut)]
945    async fn create_graph(&self) -> Result<CreateGraphResponse, RusotoError<CreateGraphError>> {
946        let request_uri = "/graph";
947
948        let mut request = SignedRequest::new("POST", "detective", &self.region, &request_uri);
949        request.set_content_type("application/x-amz-json-1.1".to_owned());
950
951        request.set_endpoint_prefix("api.detective".to_string());
952
953        let mut response = self
954            .client
955            .sign_and_dispatch(request)
956            .await
957            .map_err(RusotoError::from)?;
958        if response.status.is_success() {
959            let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
960            let result = proto::json::ResponsePayload::new(&response)
961                .deserialize::<CreateGraphResponse, _>()?;
962
963            Ok(result)
964        } else {
965            let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
966            Err(CreateGraphError::from_response(response))
967        }
968    }
969
970    /// <p><p>Sends a request to invite the specified AWS accounts to be member accounts in the behavior graph. This operation can only be called by the master account for a behavior graph. </p> <p> <code>CreateMembers</code> verifies the accounts and then sends invitations to the verified accounts.</p> <p>The request provides the behavior graph ARN and the list of accounts to invite.</p> <p>The response separates the requested accounts into two lists:</p> <ul> <li> <p>The accounts that <code>CreateMembers</code> was able to start the verification for. This list includes member accounts that are being verified, that have passed verification and are being sent an invitation, and that have failed verification.</p> </li> <li> <p>The accounts that <code>CreateMembers</code> was unable to process. This list includes accounts that were already invited to be member accounts in the behavior graph.</p> </li> </ul></p>
971    #[allow(unused_mut)]
972    async fn create_members(
973        &self,
974        input: CreateMembersRequest,
975    ) -> Result<CreateMembersResponse, RusotoError<CreateMembersError>> {
976        let request_uri = "/graph/members";
977
978        let mut request = SignedRequest::new("POST", "detective", &self.region, &request_uri);
979        request.set_content_type("application/x-amz-json-1.1".to_owned());
980
981        request.set_endpoint_prefix("api.detective".to_string());
982        let encoded = Some(serde_json::to_vec(&input).unwrap());
983        request.set_payload(encoded);
984
985        let mut response = self
986            .client
987            .sign_and_dispatch(request)
988            .await
989            .map_err(RusotoError::from)?;
990        if response.status.is_success() {
991            let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
992            let result = proto::json::ResponsePayload::new(&response)
993                .deserialize::<CreateMembersResponse, _>()?;
994
995            Ok(result)
996        } else {
997            let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
998            Err(CreateMembersError::from_response(response))
999        }
1000    }
1001
1002    /// <p>Disables the specified behavior graph and queues it to be deleted. This operation removes the graph from each member account's list of behavior graphs.</p> <p> <code>DeleteGraph</code> can only be called by the master account for a behavior graph.</p>
1003    #[allow(unused_mut)]
1004    async fn delete_graph(
1005        &self,
1006        input: DeleteGraphRequest,
1007    ) -> Result<(), RusotoError<DeleteGraphError>> {
1008        let request_uri = "/graph/removal";
1009
1010        let mut request = SignedRequest::new("POST", "detective", &self.region, &request_uri);
1011        request.set_content_type("application/x-amz-json-1.1".to_owned());
1012
1013        request.set_endpoint_prefix("api.detective".to_string());
1014        let encoded = Some(serde_json::to_vec(&input).unwrap());
1015        request.set_payload(encoded);
1016
1017        let mut response = self
1018            .client
1019            .sign_and_dispatch(request)
1020            .await
1021            .map_err(RusotoError::from)?;
1022        if response.status.is_success() {
1023            let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1024            let result = ::std::mem::drop(response);
1025
1026            Ok(result)
1027        } else {
1028            let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1029            Err(DeleteGraphError::from_response(response))
1030        }
1031    }
1032
1033    /// <p>Deletes one or more member accounts from the master account behavior graph. This operation can only be called by a Detective master account. That account cannot use <code>DeleteMembers</code> to delete their own account from the behavior graph. To disable a behavior graph, the master account uses the <code>DeleteGraph</code> API method.</p>
1034    #[allow(unused_mut)]
1035    async fn delete_members(
1036        &self,
1037        input: DeleteMembersRequest,
1038    ) -> Result<DeleteMembersResponse, RusotoError<DeleteMembersError>> {
1039        let request_uri = "/graph/members/removal";
1040
1041        let mut request = SignedRequest::new("POST", "detective", &self.region, &request_uri);
1042        request.set_content_type("application/x-amz-json-1.1".to_owned());
1043
1044        request.set_endpoint_prefix("api.detective".to_string());
1045        let encoded = Some(serde_json::to_vec(&input).unwrap());
1046        request.set_payload(encoded);
1047
1048        let mut response = self
1049            .client
1050            .sign_and_dispatch(request)
1051            .await
1052            .map_err(RusotoError::from)?;
1053        if response.status.is_success() {
1054            let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1055            let result = proto::json::ResponsePayload::new(&response)
1056                .deserialize::<DeleteMembersResponse, _>()?;
1057
1058            Ok(result)
1059        } else {
1060            let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1061            Err(DeleteMembersError::from_response(response))
1062        }
1063    }
1064
1065    /// <p>Removes the member account from the specified behavior graph. This operation can only be called by a member account that has the <code>ENABLED</code> status.</p>
1066    #[allow(unused_mut)]
1067    async fn disassociate_membership(
1068        &self,
1069        input: DisassociateMembershipRequest,
1070    ) -> Result<(), RusotoError<DisassociateMembershipError>> {
1071        let request_uri = "/membership/removal";
1072
1073        let mut request = SignedRequest::new("POST", "detective", &self.region, &request_uri);
1074        request.set_content_type("application/x-amz-json-1.1".to_owned());
1075
1076        request.set_endpoint_prefix("api.detective".to_string());
1077        let encoded = Some(serde_json::to_vec(&input).unwrap());
1078        request.set_payload(encoded);
1079
1080        let mut response = self
1081            .client
1082            .sign_and_dispatch(request)
1083            .await
1084            .map_err(RusotoError::from)?;
1085        if response.status.is_success() {
1086            let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1087            let result = ::std::mem::drop(response);
1088
1089            Ok(result)
1090        } else {
1091            let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1092            Err(DisassociateMembershipError::from_response(response))
1093        }
1094    }
1095
1096    /// <p>Returns the membership details for specified member accounts for a behavior graph.</p>
1097    #[allow(unused_mut)]
1098    async fn get_members(
1099        &self,
1100        input: GetMembersRequest,
1101    ) -> Result<GetMembersResponse, RusotoError<GetMembersError>> {
1102        let request_uri = "/graph/members/get";
1103
1104        let mut request = SignedRequest::new("POST", "detective", &self.region, &request_uri);
1105        request.set_content_type("application/x-amz-json-1.1".to_owned());
1106
1107        request.set_endpoint_prefix("api.detective".to_string());
1108        let encoded = Some(serde_json::to_vec(&input).unwrap());
1109        request.set_payload(encoded);
1110
1111        let mut response = self
1112            .client
1113            .sign_and_dispatch(request)
1114            .await
1115            .map_err(RusotoError::from)?;
1116        if response.status.is_success() {
1117            let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1118            let result = proto::json::ResponsePayload::new(&response)
1119                .deserialize::<GetMembersResponse, _>()?;
1120
1121            Ok(result)
1122        } else {
1123            let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1124            Err(GetMembersError::from_response(response))
1125        }
1126    }
1127
1128    /// <p>Returns the list of behavior graphs that the calling account is a master of. This operation can only be called by a master account.</p> <p>Because an account can currently only be the master of one behavior graph within a Region, the results always contain a single graph.</p>
1129    #[allow(unused_mut)]
1130    async fn list_graphs(
1131        &self,
1132        input: ListGraphsRequest,
1133    ) -> Result<ListGraphsResponse, RusotoError<ListGraphsError>> {
1134        let request_uri = "/graphs/list";
1135
1136        let mut request = SignedRequest::new("POST", "detective", &self.region, &request_uri);
1137        request.set_content_type("application/x-amz-json-1.1".to_owned());
1138
1139        request.set_endpoint_prefix("api.detective".to_string());
1140        let encoded = Some(serde_json::to_vec(&input).unwrap());
1141        request.set_payload(encoded);
1142
1143        let mut response = self
1144            .client
1145            .sign_and_dispatch(request)
1146            .await
1147            .map_err(RusotoError::from)?;
1148        if response.status.is_success() {
1149            let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1150            let result = proto::json::ResponsePayload::new(&response)
1151                .deserialize::<ListGraphsResponse, _>()?;
1152
1153            Ok(result)
1154        } else {
1155            let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1156            Err(ListGraphsError::from_response(response))
1157        }
1158    }
1159
1160    /// <p>Retrieves the list of open and accepted behavior graph invitations for the member account. This operation can only be called by a member account.</p> <p>Open invitations are invitations that the member account has not responded to.</p> <p>The results do not include behavior graphs for which the member account declined the invitation. The results also do not include behavior graphs that the member account resigned from or was removed from.</p>
1161    #[allow(unused_mut)]
1162    async fn list_invitations(
1163        &self,
1164        input: ListInvitationsRequest,
1165    ) -> Result<ListInvitationsResponse, RusotoError<ListInvitationsError>> {
1166        let request_uri = "/invitations/list";
1167
1168        let mut request = SignedRequest::new("POST", "detective", &self.region, &request_uri);
1169        request.set_content_type("application/x-amz-json-1.1".to_owned());
1170
1171        request.set_endpoint_prefix("api.detective".to_string());
1172        let encoded = Some(serde_json::to_vec(&input).unwrap());
1173        request.set_payload(encoded);
1174
1175        let mut response = self
1176            .client
1177            .sign_and_dispatch(request)
1178            .await
1179            .map_err(RusotoError::from)?;
1180        if response.status.is_success() {
1181            let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1182            let result = proto::json::ResponsePayload::new(&response)
1183                .deserialize::<ListInvitationsResponse, _>()?;
1184
1185            Ok(result)
1186        } else {
1187            let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1188            Err(ListInvitationsError::from_response(response))
1189        }
1190    }
1191
1192    /// <p>Retrieves the list of member accounts for a behavior graph. Does not return member accounts that were removed from the behavior graph.</p>
1193    #[allow(unused_mut)]
1194    async fn list_members(
1195        &self,
1196        input: ListMembersRequest,
1197    ) -> Result<ListMembersResponse, RusotoError<ListMembersError>> {
1198        let request_uri = "/graph/members/list";
1199
1200        let mut request = SignedRequest::new("POST", "detective", &self.region, &request_uri);
1201        request.set_content_type("application/x-amz-json-1.1".to_owned());
1202
1203        request.set_endpoint_prefix("api.detective".to_string());
1204        let encoded = Some(serde_json::to_vec(&input).unwrap());
1205        request.set_payload(encoded);
1206
1207        let mut response = self
1208            .client
1209            .sign_and_dispatch(request)
1210            .await
1211            .map_err(RusotoError::from)?;
1212        if response.status.is_success() {
1213            let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1214            let result = proto::json::ResponsePayload::new(&response)
1215                .deserialize::<ListMembersResponse, _>()?;
1216
1217            Ok(result)
1218        } else {
1219            let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1220            Err(ListMembersError::from_response(response))
1221        }
1222    }
1223
1224    /// <p>Rejects an invitation to contribute the account data to a behavior graph. This operation must be called by a member account that has the <code>INVITED</code> status.</p>
1225    #[allow(unused_mut)]
1226    async fn reject_invitation(
1227        &self,
1228        input: RejectInvitationRequest,
1229    ) -> Result<(), RusotoError<RejectInvitationError>> {
1230        let request_uri = "/invitation/removal";
1231
1232        let mut request = SignedRequest::new("POST", "detective", &self.region, &request_uri);
1233        request.set_content_type("application/x-amz-json-1.1".to_owned());
1234
1235        request.set_endpoint_prefix("api.detective".to_string());
1236        let encoded = Some(serde_json::to_vec(&input).unwrap());
1237        request.set_payload(encoded);
1238
1239        let mut response = self
1240            .client
1241            .sign_and_dispatch(request)
1242            .await
1243            .map_err(RusotoError::from)?;
1244        if response.status.is_success() {
1245            let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1246            let result = ::std::mem::drop(response);
1247
1248            Ok(result)
1249        } else {
1250            let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1251            Err(RejectInvitationError::from_response(response))
1252        }
1253    }
1254
1255    /// <p><p>Sends a request to enable data ingest for a member account that has a status of <code>ACCEPTED<em>BUT</em>DISABLED</code>.</p> <p>For valid member accounts, the status is updated as follows.</p> <ul> <li> <p>If Detective enabled the member account, then the new status is <code>ENABLED</code>.</p> </li> <li> <p>If Detective cannot enable the member account, the status remains <code>ACCEPTED<em>BUT</em>DISABLED</code>. </p> </li> </ul></p>
1256    #[allow(unused_mut)]
1257    async fn start_monitoring_member(
1258        &self,
1259        input: StartMonitoringMemberRequest,
1260    ) -> Result<(), RusotoError<StartMonitoringMemberError>> {
1261        let request_uri = "/graph/member/monitoringstate";
1262
1263        let mut request = SignedRequest::new("POST", "detective", &self.region, &request_uri);
1264        request.set_content_type("application/x-amz-json-1.1".to_owned());
1265
1266        request.set_endpoint_prefix("api.detective".to_string());
1267        let encoded = Some(serde_json::to_vec(&input).unwrap());
1268        request.set_payload(encoded);
1269
1270        let mut response = self
1271            .client
1272            .sign_and_dispatch(request)
1273            .await
1274            .map_err(RusotoError::from)?;
1275        if response.status.is_success() {
1276            let mut response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1277            let result = ::std::mem::drop(response);
1278
1279            Ok(result)
1280        } else {
1281            let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1282            Err(StartMonitoringMemberError::from_response(response))
1283        }
1284    }
1285}