|
| 1 | +// Update a SAML configuration returns "OK" response |
| 2 | +use datadog_api_client::datadog; |
| 3 | +use datadog_api_client::datadogV2::api_organizations::OrganizationsAPI; |
| 4 | +use datadog_api_client::datadogV2::model::RelationshipToRoleData; |
| 5 | +use datadog_api_client::datadogV2::model::RelationshipToRoles; |
| 6 | +use datadog_api_client::datadogV2::model::RolesType; |
| 7 | +use datadog_api_client::datadogV2::model::SAMLConfigurationRelationships; |
| 8 | +use datadog_api_client::datadogV2::model::SAMLConfigurationUpdateAttributes; |
| 9 | +use datadog_api_client::datadogV2::model::SAMLConfigurationUpdateData; |
| 10 | +use datadog_api_client::datadogV2::model::SAMLConfigurationUpdateRequest; |
| 11 | +use datadog_api_client::datadogV2::model::SAMLConfigurationsType; |
| 12 | + |
| 13 | +#[tokio::main] |
| 14 | +async fn main() { |
| 15 | + let body = SAMLConfigurationUpdateRequest::new( |
| 16 | + SAMLConfigurationUpdateData::new( |
| 17 | + "3653d3c6-0c75-11ea-ad28-fb5701eabc7d".to_string(), |
| 18 | + SAMLConfigurationsType::SAML_CONFIGURATIONS, |
| 19 | + ) |
| 20 | + .attributes( |
| 21 | + SAMLConfigurationUpdateAttributes::new() |
| 22 | + .idp_initiated(true) |
| 23 | + .jit_domains(vec!["example.com".to_string()]), |
| 24 | + ) |
| 25 | + .relationships(SAMLConfigurationRelationships::new().default_roles( |
| 26 | + RelationshipToRoles::new().data(vec![ |
| 27 | + RelationshipToRoleData::new() |
| 28 | + .id("3653d3c6-0c75-11ea-ad28-fb5701eabc7d".to_string()) |
| 29 | + .type_(RolesType::ROLES) |
| 30 | + ]), |
| 31 | + )), |
| 32 | + ); |
| 33 | + let configuration = datadog::Configuration::new(); |
| 34 | + let api = OrganizationsAPI::with_config(configuration); |
| 35 | + let resp = api |
| 36 | + .update_saml_configuration("3653d3c6-0c75-11ea-ad28-fb5701eabc7d".to_string(), body) |
| 37 | + .await; |
| 38 | + if let Ok(value) = resp { |
| 39 | + println!("{:#?}", value); |
| 40 | + } else { |
| 41 | + println!("{:#?}", resp.unwrap_err()); |
| 42 | + } |
| 43 | +} |
0 commit comments