Skip to content

Commit

Permalink
Fix edge case naming (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
skarimo authored Feb 23, 2024
1 parent f853875 commit ed3224c
Show file tree
Hide file tree
Showing 28 changed files with 118 additions and 118 deletions.
5 changes: 5 additions & 0 deletions .generator/src/generator/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@
PATTERN_FOLLOWING_ALPHA = re.compile(r"([a-z0-9])([A-Z])")
PATTERN_WHITESPACE = re.compile(r"\W")

EDGE_CASES = {"IdP": "Idp", "AuthNMapping": "AuthnMapping", "AuthN ": "Authn ", "IoT": "Iot", "SLOs": "Slos"}


def snake_case(value):
for token, replacement in EDGE_CASES.items():
value = value.replace(token, replacement)

s1 = PATTERN_LEADING_ALPHA.sub(r"\1_\2", value)
s1 = PATTERN_FOLLOWING_ALPHA.sub(r"\1_\2", s1).lower()
s1 = PATTERN_WHITESPACE.sub("_", s1)
Expand Down
8 changes: 4 additions & 4 deletions src/datadogV1/api/api_organizations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub enum UpdateOrgError {
UnknownValue(serde_json::Value),
}

/// UploadIdPForOrgError is a struct for typed errors of method [`OrganizationsAPI::upload_id_p_for_org`]
/// UploadIdPForOrgError is a struct for typed errors of method [`OrganizationsAPI::upload_idp_for_org`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UploadIdPForOrgError {
Expand Down Expand Up @@ -468,13 +468,13 @@ impl OrganizationsAPI {
/// * **Multipart Form-Data**: Post the IdP metadata file using a form post.
///
/// * **XML Body:** Post the IdP metadata file as the body of the request.
pub async fn upload_id_p_for_org(
pub async fn upload_idp_for_org(
&self,
public_id: String,
idp_file: Vec<u8>,
) -> Result<Option<crate::datadogV1::model::IdpResponse>, Error<UploadIdPForOrgError>> {
match self
.upload_id_p_for_org_with_http_info(public_id, idp_file)
.upload_idp_for_org_with_http_info(public_id, idp_file)
.await
{
Ok(response_content) => Ok(response_content.entity),
Expand All @@ -488,7 +488,7 @@ impl OrganizationsAPI {
/// * **Multipart Form-Data**: Post the IdP metadata file using a form post.
///
/// * **XML Body:** Post the IdP metadata file as the body of the request.
pub async fn upload_id_p_for_org_with_http_info(
pub async fn upload_idp_for_org_with_http_info(
&self,
public_id: String,
idp_file: Vec<u8>,
Expand Down
10 changes: 5 additions & 5 deletions src/datadogV1/api/api_service_level_objectives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl GetSLOHistoryOptionalParams {
}
}

/// ListSLOsOptionalParams is a struct for passing parameters to the method [`ServiceLevelObjectivesAPI::list_sl_os`]
/// ListSLOsOptionalParams is a struct for passing parameters to the method [`ServiceLevelObjectivesAPI::list_slos`]
#[non_exhaustive]
#[derive(Clone, Default, Debug)]
pub struct ListSLOsOptionalParams {
Expand Down Expand Up @@ -228,7 +228,7 @@ pub enum GetSLOHistoryError {
UnknownValue(serde_json::Value),
}

/// ListSLOsError is a struct for typed errors of method [`ServiceLevelObjectivesAPI::list_sl_os`]
/// ListSLOsError is a struct for typed errors of method [`ServiceLevelObjectivesAPI::list_slos`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListSLOsError {
Expand Down Expand Up @@ -857,18 +857,18 @@ impl ServiceLevelObjectivesAPI {
}

/// Get a list of service level objective objects for your organization.
pub async fn list_sl_os(
pub async fn list_slos(
&self,
params: ListSLOsOptionalParams,
) -> Result<Option<crate::datadogV1::model::SLOListResponse>, Error<ListSLOsError>> {
match self.list_sl_os_with_http_info(params).await {
match self.list_slos_with_http_info(params).await {
Ok(response_content) => Ok(response_content.entity),
Err(err) => Err(err),
}
}

/// Get a list of service level objective objects for your organization.
pub async fn list_sl_os_with_http_info(
pub async fn list_slos_with_http_info(
&self,
params: ListSLOsOptionalParams,
) -> Result<ResponseContent<crate::datadogV1::model::SLOListResponse>, Error<ListSLOsError>>
Expand Down
8 changes: 4 additions & 4 deletions src/datadogV1/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1548,10 +1548,10 @@ pub mod model_usage_ingested_spans_response;
pub use self::model_usage_ingested_spans_response::UsageIngestedSpansResponse;
pub mod model_usage_ingested_spans_hour;
pub use self::model_usage_ingested_spans_hour::UsageIngestedSpansHour;
pub mod model_usage_io_t_response;
pub use self::model_usage_io_t_response::UsageIoTResponse;
pub mod model_usage_io_t_hour;
pub use self::model_usage_io_t_hour::UsageIoTHour;
pub mod model_usage_iot_response;
pub use self::model_usage_iot_response::UsageIoTResponse;
pub mod model_usage_iot_hour;
pub use self::model_usage_iot_hour::UsageIoTHour;
pub mod model_usage_logs_response;
pub use self::model_usage_logs_response::UsageLogsResponse;
pub mod model_usage_logs_hour;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::datadog::*;
use reqwest;
use serde::{Deserialize, Serialize};

/// ListAuthNMappingsOptionalParams is a struct for passing parameters to the method [`AuthNMappingsAPI::list_auth_n_mappings`]
/// ListAuthNMappingsOptionalParams is a struct for passing parameters to the method [`AuthNMappingsAPI::list_authn_mappings`]
#[non_exhaustive]
#[derive(Clone, Default, Debug)]
pub struct ListAuthNMappingsOptionalParams {
Expand Down Expand Up @@ -42,7 +42,7 @@ impl ListAuthNMappingsOptionalParams {
}
}

/// CreateAuthNMappingError is a struct for typed errors of method [`AuthNMappingsAPI::create_auth_n_mapping`]
/// CreateAuthNMappingError is a struct for typed errors of method [`AuthNMappingsAPI::create_authn_mapping`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateAuthNMappingError {
Expand All @@ -53,7 +53,7 @@ pub enum CreateAuthNMappingError {
UnknownValue(serde_json::Value),
}

/// DeleteAuthNMappingError is a struct for typed errors of method [`AuthNMappingsAPI::delete_auth_n_mapping`]
/// DeleteAuthNMappingError is a struct for typed errors of method [`AuthNMappingsAPI::delete_authn_mapping`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteAuthNMappingError {
Expand All @@ -63,7 +63,7 @@ pub enum DeleteAuthNMappingError {
UnknownValue(serde_json::Value),
}

/// GetAuthNMappingError is a struct for typed errors of method [`AuthNMappingsAPI::get_auth_n_mapping`]
/// GetAuthNMappingError is a struct for typed errors of method [`AuthNMappingsAPI::get_authn_mapping`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetAuthNMappingError {
Expand All @@ -73,7 +73,7 @@ pub enum GetAuthNMappingError {
UnknownValue(serde_json::Value),
}

/// ListAuthNMappingsError is a struct for typed errors of method [`AuthNMappingsAPI::list_auth_n_mappings`]
/// ListAuthNMappingsError is a struct for typed errors of method [`AuthNMappingsAPI::list_authn_mappings`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListAuthNMappingsError {
Expand All @@ -82,7 +82,7 @@ pub enum ListAuthNMappingsError {
UnknownValue(serde_json::Value),
}

/// UpdateAuthNMappingError is a struct for typed errors of method [`AuthNMappingsAPI::update_auth_n_mapping`]
/// UpdateAuthNMappingError is a struct for typed errors of method [`AuthNMappingsAPI::update_authn_mapping`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateAuthNMappingError {
Expand Down Expand Up @@ -117,19 +117,19 @@ impl AuthNMappingsAPI {
}

/// Create an AuthN Mapping.
pub async fn create_auth_n_mapping(
pub async fn create_authn_mapping(
&self,
body: crate::datadogV2::model::AuthNMappingCreateRequest,
) -> Result<Option<crate::datadogV2::model::AuthNMappingResponse>, Error<CreateAuthNMappingError>>
{
match self.create_auth_n_mapping_with_http_info(body).await {
match self.create_authn_mapping_with_http_info(body).await {
Ok(response_content) => Ok(response_content.entity),
Err(err) => Err(err),
}
}

/// Create an AuthN Mapping.
pub async fn create_auth_n_mapping_with_http_info(
pub async fn create_authn_mapping_with_http_info(
&self,
body: crate::datadogV2::model::AuthNMappingCreateRequest,
) -> Result<
Expand Down Expand Up @@ -192,12 +192,12 @@ impl AuthNMappingsAPI {
}

/// Delete an AuthN Mapping specified by AuthN Mapping UUID.
pub async fn delete_auth_n_mapping(
pub async fn delete_authn_mapping(
&self,
authn_mapping_id: String,
) -> Result<Option<()>, Error<DeleteAuthNMappingError>> {
match self
.delete_auth_n_mapping_with_http_info(authn_mapping_id)
.delete_authn_mapping_with_http_info(authn_mapping_id)
.await
{
Ok(response_content) => Ok(response_content.entity),
Expand All @@ -206,7 +206,7 @@ impl AuthNMappingsAPI {
}

/// Delete an AuthN Mapping specified by AuthN Mapping UUID.
pub async fn delete_auth_n_mapping_with_http_info(
pub async fn delete_authn_mapping_with_http_info(
&self,
authn_mapping_id: String,
) -> Result<ResponseContent<()>, Error<DeleteAuthNMappingError>> {
Expand Down Expand Up @@ -261,13 +261,13 @@ impl AuthNMappingsAPI {
}

/// Get an AuthN Mapping specified by the AuthN Mapping UUID.
pub async fn get_auth_n_mapping(
pub async fn get_authn_mapping(
&self,
authn_mapping_id: String,
) -> Result<Option<crate::datadogV2::model::AuthNMappingResponse>, Error<GetAuthNMappingError>>
{
match self
.get_auth_n_mapping_with_http_info(authn_mapping_id)
.get_authn_mapping_with_http_info(authn_mapping_id)
.await
{
Ok(response_content) => Ok(response_content.entity),
Expand All @@ -276,7 +276,7 @@ impl AuthNMappingsAPI {
}

/// Get an AuthN Mapping specified by the AuthN Mapping UUID.
pub async fn get_auth_n_mapping_with_http_info(
pub async fn get_authn_mapping_with_http_info(
&self,
authn_mapping_id: String,
) -> Result<
Expand Down Expand Up @@ -336,19 +336,19 @@ impl AuthNMappingsAPI {
}

/// List all AuthN Mappings in the org.
pub async fn list_auth_n_mappings(
pub async fn list_authn_mappings(
&self,
params: ListAuthNMappingsOptionalParams,
) -> Result<Option<crate::datadogV2::model::AuthNMappingsResponse>, Error<ListAuthNMappingsError>>
{
match self.list_auth_n_mappings_with_http_info(params).await {
match self.list_authn_mappings_with_http_info(params).await {
Ok(response_content) => Ok(response_content.entity),
Err(err) => Err(err),
}
}

/// List all AuthN Mappings in the org.
pub async fn list_auth_n_mappings_with_http_info(
pub async fn list_authn_mappings_with_http_info(
&self,
params: ListAuthNMappingsOptionalParams,
) -> Result<
Expand Down Expand Up @@ -427,14 +427,14 @@ impl AuthNMappingsAPI {
}

/// Edit an AuthN Mapping.
pub async fn update_auth_n_mapping(
pub async fn update_authn_mapping(
&self,
authn_mapping_id: String,
body: crate::datadogV2::model::AuthNMappingUpdateRequest,
) -> Result<Option<crate::datadogV2::model::AuthNMappingResponse>, Error<UpdateAuthNMappingError>>
{
match self
.update_auth_n_mapping_with_http_info(authn_mapping_id, body)
.update_authn_mapping_with_http_info(authn_mapping_id, body)
.await
{
Ok(response_content) => Ok(response_content.entity),
Expand All @@ -443,7 +443,7 @@ impl AuthNMappingsAPI {
}

/// Edit an AuthN Mapping.
pub async fn update_auth_n_mapping_with_http_info(
pub async fn update_authn_mapping_with_http_info(
&self,
authn_mapping_id: String,
body: crate::datadogV2::model::AuthNMappingUpdateRequest,
Expand Down
10 changes: 5 additions & 5 deletions src/datadogV2/api/api_organizations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::datadog::*;
use reqwest;
use serde::{Deserialize, Serialize};

/// UploadIdPMetadataOptionalParams is a struct for passing parameters to the method [`OrganizationsAPI::upload_id_p_metadata`]
/// UploadIdPMetadataOptionalParams is a struct for passing parameters to the method [`OrganizationsAPI::upload_idp_metadata`]
#[non_exhaustive]
#[derive(Clone, Default, Debug)]
pub struct UploadIdPMetadataOptionalParams {
Expand All @@ -21,7 +21,7 @@ impl UploadIdPMetadataOptionalParams {
}
}

/// UploadIdPMetadataError is a struct for typed errors of method [`OrganizationsAPI::upload_id_p_metadata`]
/// UploadIdPMetadataError is a struct for typed errors of method [`OrganizationsAPI::upload_idp_metadata`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UploadIdPMetadataError {
Expand Down Expand Up @@ -55,11 +55,11 @@ impl OrganizationsAPI {
/// Endpoint for uploading IdP metadata for SAML setup.
///
/// Use this endpoint to upload or replace IdP metadata for SAML login configuration.
pub async fn upload_id_p_metadata(
pub async fn upload_idp_metadata(
&self,
params: UploadIdPMetadataOptionalParams,
) -> Result<Option<()>, Error<UploadIdPMetadataError>> {
match self.upload_id_p_metadata_with_http_info(params).await {
match self.upload_idp_metadata_with_http_info(params).await {
Ok(response_content) => Ok(response_content.entity),
Err(err) => Err(err),
}
Expand All @@ -68,7 +68,7 @@ impl OrganizationsAPI {
/// Endpoint for uploading IdP metadata for SAML setup.
///
/// Use this endpoint to upload or replace IdP metadata for SAML login configuration.
pub async fn upload_id_p_metadata_with_http_info(
pub async fn upload_idp_metadata_with_http_info(
&self,
params: UploadIdPMetadataOptionalParams,
) -> Result<ResponseContent<()>, Error<UploadIdPMetadataError>> {
Expand Down
2 changes: 1 addition & 1 deletion src/datadogV2/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

pub mod api_apm_retention_filters;
pub mod api_audit;
pub mod api_auth_n_mappings;
pub mod api_authn_mappings;
pub mod api_ci_visibility_pipelines;
pub mod api_ci_visibility_tests;
pub mod api_cloud_cost_management;
Expand Down
Loading

0 comments on commit ed3224c

Please sign in to comment.