v2_fastly_integration_CreateFastlyService/
v2_fastly-integration_CreateFastlyService.rs

1// Add Fastly service returns "CREATED" response
2use datadog_api_client::datadog;
3use datadog_api_client::datadogV2::api_fastly_integration::FastlyIntegrationAPI;
4use datadog_api_client::datadogV2::model::FastlyServiceAttributes;
5use datadog_api_client::datadogV2::model::FastlyServiceData;
6use datadog_api_client::datadogV2::model::FastlyServiceRequest;
7use datadog_api_client::datadogV2::model::FastlyServiceType;
8
9#[tokio::main]
10async fn main() {
11    let body = FastlyServiceRequest::new(
12        FastlyServiceData::new("abc123".to_string(), FastlyServiceType::FASTLY_SERVICES)
13            .attributes(
14                FastlyServiceAttributes::new()
15                    .tags(vec!["myTag".to_string(), "myTag2:myValue".to_string()]),
16            ),
17    );
18    let configuration = datadog::Configuration::new();
19    let api = FastlyIntegrationAPI::with_config(configuration);
20    let resp = api
21        .create_fastly_service("account_id".to_string(), body)
22        .await;
23    if let Ok(value) = resp {
24        println!("{:#?}", value);
25    } else {
26        println!("{:#?}", resp.unwrap_err());
27    }
28}