pub struct ServiceDefinitionAPI { /* private fields */ }
Expand description
API to create, update, retrieve and delete service definitions. Note: Service Catalog v3.0 schema has new API endpoints documented under Software Catalog. Use the following Service Definition endpoints for v2.2 and earlier.
Implementations§
Source§impl ServiceDefinitionAPI
impl ServiceDefinitionAPI
pub fn new() -> Self
Sourcepub fn with_config(config: Configuration) -> Self
pub fn with_config(config: Configuration) -> Self
Examples found in repository?
6async fn main() {
7 let configuration = datadog::Configuration::new();
8 let api = ServiceDefinitionAPI::with_config(configuration);
9 let resp = api
10 .delete_service_definition("service-definition-test".to_string())
11 .await;
12 if let Ok(value) = resp {
13 println!("{:#?}", value);
14 } else {
15 println!("{:#?}", resp.unwrap_err());
16 }
17}
More examples
8async fn main() {
9 let configuration = datadog::Configuration::new();
10 let api = ServiceDefinitionAPI::with_config(configuration);
11 let resp = api
12 .list_service_definitions(
13 ListServiceDefinitionsOptionalParams::default()
14 .schema_version(ServiceDefinitionSchemaVersions::V2_1),
15 )
16 .await;
17 if let Ok(value) = resp {
18 println!("{:#?}", value);
19 } else {
20 println!("{:#?}", resp.unwrap_err());
21 }
22}
9async fn main() {
10 let configuration = datadog::Configuration::new();
11 let api = ServiceDefinitionAPI::with_config(configuration);
12 let response = api.list_service_definitions_with_pagination(
13 ListServiceDefinitionsOptionalParams::default().page_size(2),
14 );
15 pin_mut!(response);
16 while let Some(resp) = response.next().await {
17 if let Ok(value) = resp {
18 println!("{:#?}", value);
19 } else {
20 println!("{:#?}", resp.unwrap_err());
21 }
22 }
23}
8async fn main() {
9 let configuration = datadog::Configuration::new();
10 let api = ServiceDefinitionAPI::with_config(configuration);
11 let resp = api
12 .get_service_definition(
13 "service-definition-test".to_string(),
14 GetServiceDefinitionOptionalParams::default()
15 .schema_version(ServiceDefinitionSchemaVersions::V2_1),
16 )
17 .await;
18 if let Ok(value) = resp {
19 println!("{:#?}", value);
20 } else {
21 println!("{:#?}", resp.unwrap_err());
22 }
23}
21async fn main() {
22 let body = ServiceDefinitionsCreateRequest::ServiceDefinitionV2(Box::new(
23 ServiceDefinitionV2::new(
24 "service-exampleservicedefinition".to_string(),
25 ServiceDefinitionV2Version::V2,
26 )
27 .contacts(vec![ServiceDefinitionV2Contact::ServiceDefinitionV2Email(
28 Box::new(
29 ServiceDefinitionV2Email::new(
30 "contact@datadoghq.com".to_string(),
31 ServiceDefinitionV2EmailType::EMAIL,
32 )
33 .name("Team Email".to_string()),
34 ),
35 )])
36 .dd_team("my-team".to_string())
37 .docs(vec![ServiceDefinitionV2Doc::new(
38 "Architecture".to_string(),
39 "https://gdrive/mydoc".to_string(),
40 )
41 .provider("google drive".to_string())])
42 .extensions(BTreeMap::from([(
43 "myorgextension".to_string(),
44 Value::from("extensionvalue"),
45 )]))
46 .integrations(
47 ServiceDefinitionV2Integrations::new()
48 .opsgenie(
49 ServiceDefinitionV2Opsgenie::new(
50 "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"
51 .to_string(),
52 )
53 .region(ServiceDefinitionV2OpsgenieRegion::US),
54 )
55 .pagerduty("https://my-org.pagerduty.com/service-directory/PMyService".to_string()),
56 )
57 .links(vec![ServiceDefinitionV2Link::new(
58 "Runbook".to_string(),
59 ServiceDefinitionV2LinkType::RUNBOOK,
60 "https://my-runbook".to_string(),
61 )])
62 .repos(vec![ServiceDefinitionV2Repo::new(
63 "Source Code".to_string(),
64 "https://github.com/DataDog/schema".to_string(),
65 )
66 .provider("GitHub".to_string())])
67 .tags(vec!["my:tag".to_string(), "service:tag".to_string()])
68 .team("my-team".to_string()),
69 ));
70 let configuration = datadog::Configuration::new();
71 let api = ServiceDefinitionAPI::with_config(configuration);
72 let resp = api.create_or_update_service_definitions(body).await;
73 if let Ok(value) = resp {
74 println!("{:#?}", value);
75 } else {
76 println!("{:#?}", resp.unwrap_err());
77 }
78}
17async fn main() {
18 let body = ServiceDefinitionsCreateRequest::ServiceDefinitionV2Dot2(Box::new(
19 ServiceDefinitionV2Dot2::new(
20 "service-exampleservicedefinition".to_string(),
21 ServiceDefinitionV2Dot2Version::V2_2,
22 )
23 .contacts(vec![ServiceDefinitionV2Dot2Contact::new(
24 "contact@datadoghq.com".to_string(),
25 "email".to_string(),
26 )
27 .name("Team Email".to_string())])
28 .extensions(BTreeMap::from([(
29 "myorgextension".to_string(),
30 Value::from("extensionvalue"),
31 )]))
32 .integrations(
33 ServiceDefinitionV2Dot2Integrations::new()
34 .opsgenie(
35 ServiceDefinitionV2Dot2Opsgenie::new(
36 "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"
37 .to_string(),
38 )
39 .region(ServiceDefinitionV2Dot2OpsgenieRegion::US),
40 )
41 .pagerduty(ServiceDefinitionV2Dot2Pagerduty::new().service_url(
42 "https://my-org.pagerduty.com/service-directory/PMyService".to_string(),
43 )),
44 )
45 .links(vec![
46 ServiceDefinitionV2Dot2Link::new(
47 "Runbook".to_string(),
48 "runbook".to_string(),
49 "https://my-runbook".to_string(),
50 ),
51 ServiceDefinitionV2Dot2Link::new(
52 "Source Code".to_string(),
53 "repo".to_string(),
54 "https://github.com/DataDog/schema".to_string(),
55 )
56 .provider("GitHub".to_string()),
57 ServiceDefinitionV2Dot2Link::new(
58 "Architecture".to_string(),
59 "doc".to_string(),
60 "https://my-runbook".to_string(),
61 )
62 .provider("Gigoogle drivetHub".to_string()),
63 ])
64 .tags(vec!["my:tag".to_string(), "service:tag".to_string()])
65 .team("my-team".to_string()),
66 ));
67 let configuration = datadog::Configuration::new();
68 let api = ServiceDefinitionAPI::with_config(configuration);
69 let resp = api.create_or_update_service_definitions(body).await;
70 if let Ok(value) = resp {
71 println!("{:#?}", value);
72 } else {
73 println!("{:#?}", resp.unwrap_err());
74 }
75}
pub fn with_client_and_config( config: Configuration, client: ClientWithMiddleware, ) -> Self
Sourcepub async fn create_or_update_service_definitions(
&self,
body: ServiceDefinitionsCreateRequest,
) -> Result<ServiceDefinitionCreateResponse, Error<CreateOrUpdateServiceDefinitionsError>>
pub async fn create_or_update_service_definitions( &self, body: ServiceDefinitionsCreateRequest, ) -> Result<ServiceDefinitionCreateResponse, Error<CreateOrUpdateServiceDefinitionsError>>
Create or update service definition in the Datadog Service Catalog.
Examples found in repository?
21async fn main() {
22 let body = ServiceDefinitionsCreateRequest::ServiceDefinitionV2(Box::new(
23 ServiceDefinitionV2::new(
24 "service-exampleservicedefinition".to_string(),
25 ServiceDefinitionV2Version::V2,
26 )
27 .contacts(vec![ServiceDefinitionV2Contact::ServiceDefinitionV2Email(
28 Box::new(
29 ServiceDefinitionV2Email::new(
30 "contact@datadoghq.com".to_string(),
31 ServiceDefinitionV2EmailType::EMAIL,
32 )
33 .name("Team Email".to_string()),
34 ),
35 )])
36 .dd_team("my-team".to_string())
37 .docs(vec![ServiceDefinitionV2Doc::new(
38 "Architecture".to_string(),
39 "https://gdrive/mydoc".to_string(),
40 )
41 .provider("google drive".to_string())])
42 .extensions(BTreeMap::from([(
43 "myorgextension".to_string(),
44 Value::from("extensionvalue"),
45 )]))
46 .integrations(
47 ServiceDefinitionV2Integrations::new()
48 .opsgenie(
49 ServiceDefinitionV2Opsgenie::new(
50 "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"
51 .to_string(),
52 )
53 .region(ServiceDefinitionV2OpsgenieRegion::US),
54 )
55 .pagerduty("https://my-org.pagerduty.com/service-directory/PMyService".to_string()),
56 )
57 .links(vec![ServiceDefinitionV2Link::new(
58 "Runbook".to_string(),
59 ServiceDefinitionV2LinkType::RUNBOOK,
60 "https://my-runbook".to_string(),
61 )])
62 .repos(vec![ServiceDefinitionV2Repo::new(
63 "Source Code".to_string(),
64 "https://github.com/DataDog/schema".to_string(),
65 )
66 .provider("GitHub".to_string())])
67 .tags(vec!["my:tag".to_string(), "service:tag".to_string()])
68 .team("my-team".to_string()),
69 ));
70 let configuration = datadog::Configuration::new();
71 let api = ServiceDefinitionAPI::with_config(configuration);
72 let resp = api.create_or_update_service_definitions(body).await;
73 if let Ok(value) = resp {
74 println!("{:#?}", value);
75 } else {
76 println!("{:#?}", resp.unwrap_err());
77 }
78}
More examples
17async fn main() {
18 let body = ServiceDefinitionsCreateRequest::ServiceDefinitionV2Dot2(Box::new(
19 ServiceDefinitionV2Dot2::new(
20 "service-exampleservicedefinition".to_string(),
21 ServiceDefinitionV2Dot2Version::V2_2,
22 )
23 .contacts(vec![ServiceDefinitionV2Dot2Contact::new(
24 "contact@datadoghq.com".to_string(),
25 "email".to_string(),
26 )
27 .name("Team Email".to_string())])
28 .extensions(BTreeMap::from([(
29 "myorgextension".to_string(),
30 Value::from("extensionvalue"),
31 )]))
32 .integrations(
33 ServiceDefinitionV2Dot2Integrations::new()
34 .opsgenie(
35 ServiceDefinitionV2Dot2Opsgenie::new(
36 "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"
37 .to_string(),
38 )
39 .region(ServiceDefinitionV2Dot2OpsgenieRegion::US),
40 )
41 .pagerduty(ServiceDefinitionV2Dot2Pagerduty::new().service_url(
42 "https://my-org.pagerduty.com/service-directory/PMyService".to_string(),
43 )),
44 )
45 .links(vec![
46 ServiceDefinitionV2Dot2Link::new(
47 "Runbook".to_string(),
48 "runbook".to_string(),
49 "https://my-runbook".to_string(),
50 ),
51 ServiceDefinitionV2Dot2Link::new(
52 "Source Code".to_string(),
53 "repo".to_string(),
54 "https://github.com/DataDog/schema".to_string(),
55 )
56 .provider("GitHub".to_string()),
57 ServiceDefinitionV2Dot2Link::new(
58 "Architecture".to_string(),
59 "doc".to_string(),
60 "https://my-runbook".to_string(),
61 )
62 .provider("Gigoogle drivetHub".to_string()),
63 ])
64 .tags(vec!["my:tag".to_string(), "service:tag".to_string()])
65 .team("my-team".to_string()),
66 ));
67 let configuration = datadog::Configuration::new();
68 let api = ServiceDefinitionAPI::with_config(configuration);
69 let resp = api.create_or_update_service_definitions(body).await;
70 if let Ok(value) = resp {
71 println!("{:#?}", value);
72 } else {
73 println!("{:#?}", resp.unwrap_err());
74 }
75}
17async fn main() {
18 let body = ServiceDefinitionsCreateRequest::ServiceDefinitionV2Dot2(Box::new(
19 ServiceDefinitionV2Dot2::new(
20 "my-service".to_string(),
21 ServiceDefinitionV2Dot2Version::V2_2,
22 )
23 .application("my-app".to_string())
24 .ci_pipeline_fingerprints(vec!["j88xdEy0J5lc".to_string(), "eZ7LMljCk8vo".to_string()])
25 .contacts(vec![ServiceDefinitionV2Dot2Contact::new(
26 "https://teams.microsoft.com/myteam".to_string(),
27 "slack".to_string(),
28 )
29 .name("My team channel".to_string())])
30 .description("My service description".to_string())
31 .extensions(BTreeMap::from([(
32 "myorg/extension".to_string(),
33 Value::from("extensionValue"),
34 )]))
35 .integrations(
36 ServiceDefinitionV2Dot2Integrations::new()
37 .opsgenie(
38 ServiceDefinitionV2Dot2Opsgenie::new(
39 "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"
40 .to_string(),
41 )
42 .region(ServiceDefinitionV2Dot2OpsgenieRegion::US),
43 )
44 .pagerduty(ServiceDefinitionV2Dot2Pagerduty::new().service_url(
45 "https://my-org.pagerduty.com/service-directory/PMyService".to_string(),
46 )),
47 )
48 .languages(vec![
49 "dotnet".to_string(),
50 "go".to_string(),
51 "java".to_string(),
52 "js".to_string(),
53 "php".to_string(),
54 "python".to_string(),
55 "ruby".to_string(),
56 "c++".to_string(),
57 ])
58 .lifecycle("sandbox".to_string())
59 .links(vec![ServiceDefinitionV2Dot2Link::new(
60 "Runbook".to_string(),
61 "runbook".to_string(),
62 "https://my-runbook".to_string(),
63 )
64 .provider("Github".to_string())])
65 .tags(vec!["my:tag".to_string(), "service:tag".to_string()])
66 .team("my-team".to_string())
67 .tier("High".to_string())
68 .type_("web".to_string()),
69 ));
70 let configuration = datadog::Configuration::new();
71 let api = ServiceDefinitionAPI::with_config(configuration);
72 let resp = api.create_or_update_service_definitions(body).await;
73 if let Ok(value) = resp {
74 println!("{:#?}", value);
75 } else {
76 println!("{:#?}", resp.unwrap_err());
77 }
78}
20async fn main() {
21 let body = ServiceDefinitionsCreateRequest::ServiceDefinitionV2Dot1(Box::new(
22 ServiceDefinitionV2Dot1::new(
23 "service-exampleservicedefinition".to_string(),
24 ServiceDefinitionV2Dot1Version::V2_1,
25 )
26 .contacts(vec![
27 ServiceDefinitionV2Dot1Contact::ServiceDefinitionV2Dot1Email(Box::new(
28 ServiceDefinitionV2Dot1Email::new(
29 "contact@datadoghq.com".to_string(),
30 ServiceDefinitionV2Dot1EmailType::EMAIL,
31 )
32 .name("Team Email".to_string()),
33 )),
34 ])
35 .extensions(BTreeMap::from([(
36 "myorgextension".to_string(),
37 Value::from("extensionvalue"),
38 )]))
39 .integrations(
40 ServiceDefinitionV2Dot1Integrations::new()
41 .opsgenie(
42 ServiceDefinitionV2Dot1Opsgenie::new(
43 "https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"
44 .to_string(),
45 )
46 .region(ServiceDefinitionV2Dot1OpsgenieRegion::US),
47 )
48 .pagerduty(ServiceDefinitionV2Dot1Pagerduty::new().service_url(
49 "https://my-org.pagerduty.com/service-directory/PMyService".to_string(),
50 )),
51 )
52 .links(vec![
53 ServiceDefinitionV2Dot1Link::new(
54 "Runbook".to_string(),
55 ServiceDefinitionV2Dot1LinkType::RUNBOOK,
56 "https://my-runbook".to_string(),
57 ),
58 ServiceDefinitionV2Dot1Link::new(
59 "Source Code".to_string(),
60 ServiceDefinitionV2Dot1LinkType::REPO,
61 "https://github.com/DataDog/schema".to_string(),
62 )
63 .provider("GitHub".to_string()),
64 ServiceDefinitionV2Dot1Link::new(
65 "Architecture".to_string(),
66 ServiceDefinitionV2Dot1LinkType::DOC,
67 "https://my-runbook".to_string(),
68 )
69 .provider("Gigoogle drivetHub".to_string()),
70 ])
71 .tags(vec!["my:tag".to_string(), "service:tag".to_string()])
72 .team("my-team".to_string()),
73 ));
74 let configuration = datadog::Configuration::new();
75 let api = ServiceDefinitionAPI::with_config(configuration);
76 let resp = api.create_or_update_service_definitions(body).await;
77 if let Ok(value) = resp {
78 println!("{:#?}", value);
79 } else {
80 println!("{:#?}", resp.unwrap_err());
81 }
82}
Sourcepub async fn create_or_update_service_definitions_with_http_info(
&self,
body: ServiceDefinitionsCreateRequest,
) -> Result<ResponseContent<ServiceDefinitionCreateResponse>, Error<CreateOrUpdateServiceDefinitionsError>>
pub async fn create_or_update_service_definitions_with_http_info( &self, body: ServiceDefinitionsCreateRequest, ) -> Result<ResponseContent<ServiceDefinitionCreateResponse>, Error<CreateOrUpdateServiceDefinitionsError>>
Create or update service definition in the Datadog Service Catalog.
Sourcepub async fn delete_service_definition(
&self,
service_name: String,
) -> Result<(), Error<DeleteServiceDefinitionError>>
pub async fn delete_service_definition( &self, service_name: String, ) -> Result<(), Error<DeleteServiceDefinitionError>>
Delete a single service definition in the Datadog Service Catalog.
Examples found in repository?
6async fn main() {
7 let configuration = datadog::Configuration::new();
8 let api = ServiceDefinitionAPI::with_config(configuration);
9 let resp = api
10 .delete_service_definition("service-definition-test".to_string())
11 .await;
12 if let Ok(value) = resp {
13 println!("{:#?}", value);
14 } else {
15 println!("{:#?}", resp.unwrap_err());
16 }
17}
Sourcepub async fn delete_service_definition_with_http_info(
&self,
service_name: String,
) -> Result<ResponseContent<()>, Error<DeleteServiceDefinitionError>>
pub async fn delete_service_definition_with_http_info( &self, service_name: String, ) -> Result<ResponseContent<()>, Error<DeleteServiceDefinitionError>>
Delete a single service definition in the Datadog Service Catalog.
Sourcepub async fn get_service_definition(
&self,
service_name: String,
params: GetServiceDefinitionOptionalParams,
) -> Result<ServiceDefinitionGetResponse, Error<GetServiceDefinitionError>>
pub async fn get_service_definition( &self, service_name: String, params: GetServiceDefinitionOptionalParams, ) -> Result<ServiceDefinitionGetResponse, Error<GetServiceDefinitionError>>
Get a single service definition from the Datadog Service Catalog.
Examples found in repository?
8async fn main() {
9 let configuration = datadog::Configuration::new();
10 let api = ServiceDefinitionAPI::with_config(configuration);
11 let resp = api
12 .get_service_definition(
13 "service-definition-test".to_string(),
14 GetServiceDefinitionOptionalParams::default()
15 .schema_version(ServiceDefinitionSchemaVersions::V2_1),
16 )
17 .await;
18 if let Ok(value) = resp {
19 println!("{:#?}", value);
20 } else {
21 println!("{:#?}", resp.unwrap_err());
22 }
23}
Sourcepub async fn get_service_definition_with_http_info(
&self,
service_name: String,
params: GetServiceDefinitionOptionalParams,
) -> Result<ResponseContent<ServiceDefinitionGetResponse>, Error<GetServiceDefinitionError>>
pub async fn get_service_definition_with_http_info( &self, service_name: String, params: GetServiceDefinitionOptionalParams, ) -> Result<ResponseContent<ServiceDefinitionGetResponse>, Error<GetServiceDefinitionError>>
Get a single service definition from the Datadog Service Catalog.
Sourcepub async fn list_service_definitions(
&self,
params: ListServiceDefinitionsOptionalParams,
) -> Result<ServiceDefinitionsListResponse, Error<ListServiceDefinitionsError>>
pub async fn list_service_definitions( &self, params: ListServiceDefinitionsOptionalParams, ) -> Result<ServiceDefinitionsListResponse, Error<ListServiceDefinitionsError>>
Get a list of all service definitions from the Datadog Service Catalog.
Examples found in repository?
8async fn main() {
9 let configuration = datadog::Configuration::new();
10 let api = ServiceDefinitionAPI::with_config(configuration);
11 let resp = api
12 .list_service_definitions(
13 ListServiceDefinitionsOptionalParams::default()
14 .schema_version(ServiceDefinitionSchemaVersions::V2_1),
15 )
16 .await;
17 if let Ok(value) = resp {
18 println!("{:#?}", value);
19 } else {
20 println!("{:#?}", resp.unwrap_err());
21 }
22}
Sourcepub fn list_service_definitions_with_pagination(
&self,
params: ListServiceDefinitionsOptionalParams,
) -> impl Stream<Item = Result<ServiceDefinitionData, Error<ListServiceDefinitionsError>>> + '_
pub fn list_service_definitions_with_pagination( &self, params: ListServiceDefinitionsOptionalParams, ) -> impl Stream<Item = Result<ServiceDefinitionData, Error<ListServiceDefinitionsError>>> + '_
Examples found in repository?
9async fn main() {
10 let configuration = datadog::Configuration::new();
11 let api = ServiceDefinitionAPI::with_config(configuration);
12 let response = api.list_service_definitions_with_pagination(
13 ListServiceDefinitionsOptionalParams::default().page_size(2),
14 );
15 pin_mut!(response);
16 while let Some(resp) = response.next().await {
17 if let Ok(value) = resp {
18 println!("{:#?}", value);
19 } else {
20 println!("{:#?}", resp.unwrap_err());
21 }
22 }
23}
Sourcepub async fn list_service_definitions_with_http_info(
&self,
params: ListServiceDefinitionsOptionalParams,
) -> Result<ResponseContent<ServiceDefinitionsListResponse>, Error<ListServiceDefinitionsError>>
pub async fn list_service_definitions_with_http_info( &self, params: ListServiceDefinitionsOptionalParams, ) -> Result<ResponseContent<ServiceDefinitionsListResponse>, Error<ListServiceDefinitionsError>>
Get a list of all service definitions from the Datadog Service Catalog.
Trait Implementations§
Source§impl Clone for ServiceDefinitionAPI
impl Clone for ServiceDefinitionAPI
Source§fn clone(&self) -> ServiceDefinitionAPI
fn clone(&self) -> ServiceDefinitionAPI
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more