From b8d1914eb839f6e67496ee8cd3660d359a145a9a Mon Sep 17 00:00:00 2001 From: Artur Gadelshin Date: Fri, 11 Aug 2023 16:38:15 +0200 Subject: [PATCH] [CLO-267] add protected field (#73) * add protected field * fix an error * more errors to fix * update ubuntu to 20.04 --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- cli/src/main.rs | 10 +- cli/src/v1/infra.rs | 4 +- cli/src/v1/integrate.rs | 6 +- cli/src/v1/mesdb.rs | 2 +- generated/src/access/schemas.rs | 93 ++++++++++------ generated/src/infra/schemas.rs | 130 ++++++++++++++++++---- generated/src/integrate/schemas.rs | 107 ++++++++++++++----- generated/src/lib.rs | 1 - generated/src/mesdb/operations.rs | 24 +++++ generated/src/mesdb/schemas.rs | 154 ++++++++++++++++++++++++--- generated/src/orchestrate/schemas.rs | 34 ++++-- generated/src/resources/schemas.rs | 24 ++--- 14 files changed, 465 insertions(+), 128 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f2e5b29..dd0ae07 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ jobs: name: Build strategy: matrix: - os: [ubuntu-18.04, windows-2019, macos-11] + os: [ubuntu-20.04, windows-2019, macos-11] runs-on: ${{ matrix.os }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4707aec..0d765cf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,7 @@ jobs: name: Release strategy: matrix: - os: [ubuntu-18.04, windows-2019, macos-11] + os: [ubuntu-20.04, windows-2019, macos-11] runs-on: ${{ matrix.os }} diff --git a/cli/src/main.rs b/cli/src/main.rs index 8611899..a72a0be 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -819,6 +819,9 @@ struct CreateCluster { #[structopt(long, help = "Throughput in Mb/s for disk (only AWS)")] pub disk_throughput: Option, + + #[structopt(long, help = "The protected flag prevents from accidental deletion")] + protected: Option, } #[derive(Debug, StructOpt)] @@ -857,7 +860,10 @@ struct UpdateCluster { id: esc_api::ClusterId, #[structopt(long, help = "A human-readable description of the cluster")] - description: String, + description: Option, + + #[structopt(long, help = "The protected flag prevents from accidental deletion")] + protected: Option, } #[derive(Debug, StructOpt)] @@ -2141,6 +2147,7 @@ async fn call_api<'a, 'b>( source_backup_id: params.source_backup_id, source_node_index: None, // TODO: add source_node_index topology: params.topology, + protected: params.protected, }, ) .await?; @@ -2179,6 +2186,7 @@ async fn call_api<'a, 'b>( params.id, esc_api::mesdb::UpdateClusterRequest { description: params.description, + protected: params.protected, }, ) .await?; diff --git a/cli/src/v1/infra.rs b/cli/src/v1/infra.rs index f8b189e..40054cd 100644 --- a/cli/src/v1/infra.rs +++ b/cli/src/v1/infra.rs @@ -63,7 +63,7 @@ impl ToV1 for esc_api::infra::Network { project_id: self.project_id, provider: Provider::from_string(&self.provider), region: self.region, - status: self.status, + status: self.status.to_string(), } } } @@ -110,7 +110,7 @@ impl ToV1 for esc_api::infra::Peering { project_id: self.project_id, provider: Provider::from_string(&self.provider), routes: self.routes, - status: self.status, + status: self.status.to_string(), } } } diff --git a/cli/src/v1/integrate.rs b/cli/src/v1/integrate.rs index da5635e..251e518 100644 --- a/cli/src/v1/integrate.rs +++ b/cli/src/v1/integrate.rs @@ -41,7 +41,7 @@ pub enum IntegrationData { Unsupported, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct Integration { #[serde(rename = "created")] pub created: DateTime, @@ -106,7 +106,7 @@ impl ToV1 for esc_api::integrate::CreateIntegrationResponse { } } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct GetIntegrationResponse { #[serde(rename = "integration")] pub integration: Integration, @@ -121,7 +121,7 @@ impl ToV1 for esc_api::integrate::GetIntegrationResponse { } } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct ListIntegrationsResponse { #[serde(rename = "integrations")] pub integrations: Vec, diff --git a/cli/src/v1/mesdb.rs b/cli/src/v1/mesdb.rs index 0d1fbdb..1982f19 100644 --- a/cli/src/v1/mesdb.rs +++ b/cli/src/v1/mesdb.rs @@ -62,7 +62,7 @@ impl ToV1 for esc_api::mesdb::Cluster { provider: Provider::from_string(&self.provider), region: self.region, server_version: self.server_version, - status: self.status, + status: self.status.to_string(), topology: self.topology, }; let mut tcp = Vec::new(); diff --git a/generated/src/access/schemas.rs b/generated/src/access/schemas.rs index 1475d86..4d8216b 100644 --- a/generated/src/access/schemas.rs +++ b/generated/src/access/schemas.rs @@ -5,7 +5,7 @@ use chrono::Utc; use std::collections::HashMap; /// describes what a subject of athe policy's actions -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub enum Action { Create, @@ -25,8 +25,24 @@ impl std::fmt::Display for Action { } } } +impl std::cmp::PartialEq<&str> for Action { + fn eq(&self, other: &&str) -> bool { + match self { + Action::Create => *other == "create", + Action::Delete => *other == "delete", + Action::Modify => *other == "modify", + Action::_None => *other == "none", + Action::Read => *other == "read", + } + } +} +impl std::cmp::PartialEq for &str { + fn eq(&self, other: &Action) -> bool { + other == self + } +} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreateGroupRequest { pub name: String, @@ -34,13 +50,13 @@ pub struct CreateGroupRequest { pub members: Option>, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreateGroupResponse { pub id: GroupId, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreateInviteRequest { pub user_email: String, @@ -48,13 +64,13 @@ pub struct CreateInviteRequest { pub groups: Option>, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreateInviteResponse { pub id: InviteId, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreatePolicy { pub actions: Vec, @@ -64,20 +80,20 @@ pub struct CreatePolicy { pub subjects: Vec, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreatePolicyRequest { pub policy: CreatePolicy, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreatePolicyResponse { pub id: PolicyId, } /// the policy's effect -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub enum Effect { Allow, @@ -91,34 +107,47 @@ impl std::fmt::Display for Effect { } } } +impl std::cmp::PartialEq<&str> for Effect { + fn eq(&self, other: &&str) -> bool { + match self { + Effect::Allow => *other == "allow", + Effect::Deny => *other == "deny", + } + } +} +impl std::cmp::PartialEq for &str { + fn eq(&self, other: &Effect) -> bool { + other == self + } +} pub type Fields = HashMap; -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct GetGroupResponse { pub group: Group, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct GetMemberResponse { pub member: Member, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct GetPolicyResponse { pub policy: Policy, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct GetSettingsResponse { pub settings: Settings, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Group { pub created: DateTime, @@ -129,7 +158,7 @@ pub struct Group { pub organization_id: OrganizationId, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Invite { pub accepted: bool, @@ -143,37 +172,37 @@ pub struct Invite { pub organization_id: OrganizationId, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ListGroupsResponse { pub groups: Vec, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ListInvitesResponse { pub invites: Vec, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ListMembersResponse { pub members: Vec, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ListPoliciesResponse { pub policies: Vec, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ListUserRefreshTokensResponse { pub tokens: Vec, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Member { pub active: bool, @@ -184,7 +213,7 @@ pub struct Member { pub organization_id: String, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Policy { #[serde(skip_serializing_if = "Option::is_none")] @@ -202,33 +231,33 @@ pub struct Policy { pub subjects: Option>, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct PolicyAllowedRequest { pub action: String, pub resource: Action, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct PolicyAllowedResponse { pub allowed: bool, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ResendInviteRequest { pub id: InviteId, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Settings { pub require_mfa: bool, pub restrict_invite_domain: String, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct UpdateGroupRequest { #[serde(skip_serializing_if = "Option::is_none")] @@ -237,13 +266,13 @@ pub struct UpdateGroupRequest { pub members: Option>, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct UpdateMemberRequest { pub active: bool, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct UpdatePolicy { pub actions: Vec, @@ -253,13 +282,13 @@ pub struct UpdatePolicy { pub subjects: Vec, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct UpdatePolicyRequest { pub policy: UpdatePolicy, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct UpdateSettingsRequest { #[serde(skip_serializing_if = "Option::is_none")] @@ -268,7 +297,7 @@ pub struct UpdateSettingsRequest { pub restrict_invite_domain: Option, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct UserRefreshToken { pub id: String, diff --git a/generated/src/infra/schemas.rs b/generated/src/infra/schemas.rs index 94d934d..822962e 100644 --- a/generated/src/infra/schemas.rs +++ b/generated/src/infra/schemas.rs @@ -2,7 +2,7 @@ use super::formats::*; use crate::resources::formats::ProjectId; use std::collections::HashMap; -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Command { #[serde(skip_serializing_if = "Option::is_none")] @@ -12,7 +12,7 @@ pub struct Command { pub value: String, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreateNetworkRequest { pub provider: String, @@ -21,13 +21,13 @@ pub struct CreateNetworkRequest { pub region: String, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreateNetworkResponse { pub id: NetworkId, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreatePeeringCommandsRequest { pub provider: String, @@ -35,13 +35,13 @@ pub struct CreatePeeringCommandsRequest { pub peer_network_id: String, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreatePeeringCommandsResponse { pub commands: Vec, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreatePeeringRequest { pub network_id: NetworkId, @@ -52,7 +52,7 @@ pub struct CreatePeeringRequest { pub routes: Vec, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreatePeeringResponse { pub id: PeeringId, @@ -60,31 +60,31 @@ pub struct CreatePeeringResponse { pub type Fields = HashMap; -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct GetNetworkResponse { pub network: Network, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct GetPeeringResponse { pub peering: Peering, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ListNetworksResponse { pub networks: Vec, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ListPeeringsResponse { pub peerings: Vec, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Network { pub cidr_block: String, @@ -94,10 +94,47 @@ pub struct Network { pub project_id: ProjectId, pub provider: String, pub region: String, - pub status: String, + pub status: NetworkStatus, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub enum NetworkStatus { + Provisioning, + Defunct, + Available, + Deleting, + Deleted, +} +impl std::fmt::Display for NetworkStatus { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + NetworkStatus::Provisioning => write!(f, "provisioning"), + NetworkStatus::Defunct => write!(f, "defunct"), + NetworkStatus::Available => write!(f, "available"), + NetworkStatus::Deleting => write!(f, "deleting"), + NetworkStatus::Deleted => write!(f, "deleted"), + } + } +} +impl std::cmp::PartialEq<&str> for NetworkStatus { + fn eq(&self, other: &&str) -> bool { + match self { + NetworkStatus::Provisioning => *other == "provisioning", + NetworkStatus::Defunct => *other == "defunct", + NetworkStatus::Available => *other == "available", + NetworkStatus::Deleting => *other == "deleting", + NetworkStatus::Deleted => *other == "deleted", + } + } +} +impl std::cmp::PartialEq for &str { + fn eq(&self, other: &NetworkStatus) -> bool { + other == self + } +} + +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Peering { pub created: String, @@ -113,11 +150,54 @@ pub struct Peering { #[serde(skip_serializing_if = "Option::is_none")] pub provider_peering_metadata: Option>, pub routes: Vec, - pub status: String, + pub status: PeeringStatus, +} + +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub enum PeeringStatus { + Provisioning, + Initiated, + Active, + Defunct, + Deleting, + Deleted, + Unknown, +} +impl std::fmt::Display for PeeringStatus { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + PeeringStatus::Provisioning => write!(f, "provisioning"), + PeeringStatus::Initiated => write!(f, "initiated"), + PeeringStatus::Active => write!(f, "active"), + PeeringStatus::Defunct => write!(f, "defunct"), + PeeringStatus::Deleting => write!(f, "deleting"), + PeeringStatus::Deleted => write!(f, "deleted"), + PeeringStatus::Unknown => write!(f, "unknown"), + } + } +} +impl std::cmp::PartialEq<&str> for PeeringStatus { + fn eq(&self, other: &&str) -> bool { + match self { + PeeringStatus::Provisioning => *other == "provisioning", + PeeringStatus::Initiated => *other == "initiated", + PeeringStatus::Active => *other == "active", + PeeringStatus::Defunct => *other == "defunct", + PeeringStatus::Deleting => *other == "deleting", + PeeringStatus::Deleted => *other == "deleted", + PeeringStatus::Unknown => *other == "unknown", + } + } +} +impl std::cmp::PartialEq for &str { + fn eq(&self, other: &PeeringStatus) -> bool { + other == self + } } /// underlying cloud provider -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub enum Provider { Aws, @@ -133,14 +213,28 @@ impl std::fmt::Display for Provider { } } } +impl std::cmp::PartialEq<&str> for Provider { + fn eq(&self, other: &&str) -> bool { + match self { + Provider::Aws => *other == "aws", + Provider::Azure => *other == "azure", + Provider::Gcp => *other == "gcp", + } + } +} +impl std::cmp::PartialEq for &str { + fn eq(&self, other: &Provider) -> bool { + other == self + } +} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct UpdateNetworkRequest { pub description: String, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct UpdatePeeringRequest { pub description: String, diff --git a/generated/src/integrate/schemas.rs b/generated/src/integrate/schemas.rs index 51edffb..947c4a8 100644 --- a/generated/src/integrate/schemas.rs +++ b/generated/src/integrate/schemas.rs @@ -6,7 +6,7 @@ use chrono::Utc; use std::collections::HashMap; /// Integration for AWS CloudWatch -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct AwsCloudWatchLogsIntegrationData { #[serde(skip_serializing_if = "Option::is_none")] @@ -21,7 +21,7 @@ pub struct AwsCloudWatchLogsIntegrationData { } /// Integration for AWS CloudWatch metrics -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct AwsCloudWatchMetricsIntegrationData { #[serde(skip_serializing_if = "Option::is_none")] @@ -35,7 +35,7 @@ pub struct AwsCloudWatchMetricsIntegrationData { } /// Create AWS CloudWatch logs integration -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreateAwsCloudWatchLogsIntegrationData { pub access_key_id: String, @@ -48,7 +48,7 @@ pub struct CreateAwsCloudWatchLogsIntegrationData { } /// Create AWS CloudWatch metrics integration -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreateAwsCloudWatchMetricsIntegrationData { pub access_key_id: String, @@ -60,13 +60,26 @@ pub struct CreateAwsCloudWatchMetricsIntegrationData { pub source: String, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +/// Create GCP Operations Logging +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct CreateGcpLoggingIntegrationData { + pub gcp_project_id: String, + pub gcp_service_account_private_key: String, + pub log_id: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub source: Option, +} + +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(tag = "sink")] pub enum CreateIntegrationData { #[serde(rename = "awsCloudWatchLogs")] AwsCloudWatchLogs(CreateAwsCloudWatchLogsIntegrationData), #[serde(rename = "awsCloudWatchMetrics")] AwsCloudWatchMetrics(CreateAwsCloudWatchMetricsIntegrationData), + #[serde(rename = "gcpLogging")] + GcpLogging(CreateGcpLoggingIntegrationData), #[serde(rename = "opsGenie")] OpsGenie(CreateOpsGenieIntegrationData), #[serde(rename = "slack")] @@ -75,21 +88,21 @@ pub enum CreateIntegrationData { PagerDuty(CreatePagerDutyIntegrationData), } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreateIntegrationRequest { pub data: CreateIntegrationData, pub description: String, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreateIntegrationResponse { pub id: IntegrationId, } /// Create integration for the Ops Genie API integration -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreateOpsGenieIntegrationData { pub api_key: String, @@ -98,7 +111,7 @@ pub struct CreateOpsGenieIntegrationData { } /// Create integration for the PagerDuty API integration -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreatePagerDutyIntegrationData { pub auth_token: String, @@ -109,7 +122,7 @@ pub struct CreatePagerDutyIntegrationData { } /// Create integration for a Slack bot used by this integration. -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreateSlackIntegrationData { pub channel_id: String, @@ -120,13 +133,23 @@ pub struct CreateSlackIntegrationData { pub type Fields = HashMap; -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +/// Integration for GCP Operations Logging +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct GcpLoggingIntegrationData { + pub gcp_project_id: String, + pub log_id: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub source: Option, +} + +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct GetIntegrationResponse { pub integration: Integration, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Integration { pub created: DateTime, @@ -139,13 +162,15 @@ pub struct Integration { pub updated: DateTime, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(tag = "sink")] pub enum IntegrationData { #[serde(rename = "awsCloudWatchLogs")] AwsCloudWatchLogs(AwsCloudWatchLogsIntegrationData), #[serde(rename = "awsCloudWatchMetrics")] AwsCloudWatchMetrics(AwsCloudWatchMetricsIntegrationData), + #[serde(rename = "gcpLogging")] + GcpLogging(GcpLoggingIntegrationData), #[serde(rename = "opsGenie")] OpsGenie(OpsGenieIntegrationData), #[serde(rename = "slack")] @@ -154,13 +179,13 @@ pub enum IntegrationData { PagerDuty(PagerDutyIntegrationData), } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct IntegrationsOptionsResponse { pub sources: Vec, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub enum IntegrationStatus { Active, @@ -174,15 +199,28 @@ impl std::fmt::Display for IntegrationStatus { } } } +impl std::cmp::PartialEq<&str> for IntegrationStatus { + fn eq(&self, other: &&str) -> bool { + match self { + IntegrationStatus::Active => *other == "active", + IntegrationStatus::Deleted => *other == "deleted", + } + } +} +impl std::cmp::PartialEq for &str { + fn eq(&self, other: &IntegrationStatus) -> bool { + other == self + } +} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ListIntegrationsResponse { pub integrations: Vec, } /// Integration for the Ops Genie API integration -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct OpsGenieIntegrationData { pub api_key_display: String, @@ -190,7 +228,7 @@ pub struct OpsGenieIntegrationData { } /// Integration for the PagerDuty API integration -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct PagerDutyIntegrationData { pub auth_token_display: String, @@ -199,7 +237,7 @@ pub struct PagerDutyIntegrationData { pub source: String, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SinkSummary { pub id: String, @@ -211,7 +249,7 @@ pub struct SinkSummary { } /// Integration for a Slack bot used by this integration. -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SlackIntegrationData { pub channel_id: String, @@ -219,7 +257,7 @@ pub struct SlackIntegrationData { pub source: String, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SourceSummary { pub enabled: bool, @@ -229,7 +267,7 @@ pub struct SourceSummary { } /// Update request data for AWS CloudWatch logs -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct UpdateAwsCloudWatchLogsIntegrationData { #[serde(skip_serializing_if = "Option::is_none")] @@ -245,7 +283,7 @@ pub struct UpdateAwsCloudWatchLogsIntegrationData { } /// Update request data for AWS CloudWatch metrics -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct UpdateAwsCloudWatchMetricsIntegrationData { #[serde(skip_serializing_if = "Option::is_none")] @@ -260,17 +298,30 @@ pub struct UpdateAwsCloudWatchMetricsIntegrationData { pub secret_access_key: Option, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +/// Updates GCP Operations Logging +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct UpdateGcpLoggingIntegrationData { + #[serde(skip_serializing_if = "Option::is_none")] + pub gcp_project_id: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub gcp_service_account_private_key: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub log_id: Option, +} + +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(untagged)] pub enum UpdateIntegrationData { UpdateAwsCloudWatchLogsIntegrationData(UpdateAwsCloudWatchLogsIntegrationData), UpdateAwsCloudWatchMetricsIntegrationData(UpdateAwsCloudWatchMetricsIntegrationData), + UpdateGcpLoggingIntegrationData(UpdateGcpLoggingIntegrationData), UpdateOpsGenieIntegrationData(UpdateOpsGenieIntegrationData), UpdateSlackIntegrationData(UpdateSlackIntegrationData), UpdatePagerDutyIntegrationData(UpdatePagerDutyIntegrationData), } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct UpdateIntegrationRequest { #[serde(skip_serializing_if = "Option::is_none")] @@ -280,7 +331,7 @@ pub struct UpdateIntegrationRequest { } /// Integration for the Ops Genie API integration -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct UpdateOpsGenieIntegrationData { #[serde(skip_serializing_if = "Option::is_none")] @@ -288,7 +339,7 @@ pub struct UpdateOpsGenieIntegrationData { } /// Create integration for the PagerDuty API integration -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct UpdatePagerDutyIntegrationData { #[serde(skip_serializing_if = "Option::is_none")] @@ -300,7 +351,7 @@ pub struct UpdatePagerDutyIntegrationData { } /// Integration for a Slack bot used by this integration. -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct UpdateSlackIntegrationData { #[serde(skip_serializing_if = "Option::is_none")] diff --git a/generated/src/lib.rs b/generated/src/lib.rs index 375a6f3..7b1e27e 100644 --- a/generated/src/lib.rs +++ b/generated/src/lib.rs @@ -1,4 +1,3 @@ -#![allow(clippy::derive_partial_eq_without_eq)] #[macro_use] extern crate serde_derive; pub mod access; diff --git a/generated/src/mesdb/operations.rs b/generated/src/mesdb/operations.rs index fe5c934..1ab9f93 100644 --- a/generated/src/mesdb/operations.rs +++ b/generated/src/mesdb/operations.rs @@ -234,6 +234,30 @@ pub async fn list_clusters( .await } +/// restart a cluster +/// +/// # Arguments +/// +/// * `organization_id` - The id of the organization the cluster is owned by +/// * `project_id` - The id of the project the cluster is organized by +/// * `cluster_id` - The id of the cluster +pub async fn restart_cluster( + client: &Client, + organization_id: OrganizationId, + project_id: ProjectId, + cluster_id: ClusterId, +) -> Result { + let url = format!( + "/mesdb/v1/organizations/{organizationId}/projects/{projectId}/clusters/{clusterId}/commands/restart", + organizationId = urlencode(organization_id), + projectId = urlencode(project_id), + clusterId = urlencode(cluster_id), + ); + client + .send_request::<(), RestartClusterResponse>(Method::PUT, url, None, None) + .await +} + /// Updates a cluster /// /// # Arguments diff --git a/generated/src/mesdb/schemas.rs b/generated/src/mesdb/schemas.rs index 3eda6be..d595c1a 100644 --- a/generated/src/mesdb/schemas.rs +++ b/generated/src/mesdb/schemas.rs @@ -6,7 +6,7 @@ use chrono::DateTime; use chrono::Utc; use std::collections::HashMap; -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Backup { pub available_node_count: i32, @@ -26,7 +26,7 @@ pub struct Backup { pub status: String, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Cluster { pub can_expand_disk: bool, @@ -50,24 +50,90 @@ pub struct Cluster { pub region: String, pub server_version: String, pub server_version_tag: String, - pub status: String, + pub status: ClusterStatus, pub topology: Topology, + pub protected: bool, +} + +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +pub enum ClusterStatus { + #[serde(rename = "provisioning")] + Provisioning, + #[serde(rename = "disks available")] + DisksAvailable, + #[serde(rename = "expanding disks")] + ExpandingDisks, + #[serde(rename = "restarting")] + Restarting, + #[serde(rename = "available")] + Available, + #[serde(rename = "defunct")] + Defunct, + #[serde(rename = "inconsistent")] + Inconsistent, + #[serde(rename = "deleting instances")] + DeletingInstances, + #[serde(rename = "instances deleted")] + InstancesDeleted, + #[serde(rename = "deleting disks")] + DeletingDisks, + #[serde(rename = "deleted")] + Deleted, +} +impl std::fmt::Display for ClusterStatus { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + ClusterStatus::Provisioning => write!(f, "provisioning"), + ClusterStatus::DisksAvailable => write!(f, "disks available"), + ClusterStatus::ExpandingDisks => write!(f, "expanding disks"), + ClusterStatus::Restarting => write!(f, "restarting"), + ClusterStatus::Available => write!(f, "available"), + ClusterStatus::Defunct => write!(f, "defunct"), + ClusterStatus::Inconsistent => write!(f, "inconsistent"), + ClusterStatus::DeletingInstances => write!(f, "deleting instances"), + ClusterStatus::InstancesDeleted => write!(f, "instances deleted"), + ClusterStatus::DeletingDisks => write!(f, "deleting disks"), + ClusterStatus::Deleted => write!(f, "deleted"), + } + } +} +impl std::cmp::PartialEq<&str> for ClusterStatus { + fn eq(&self, other: &&str) -> bool { + match self { + ClusterStatus::Provisioning => *other == "provisioning", + ClusterStatus::DisksAvailable => *other == "disks available", + ClusterStatus::ExpandingDisks => *other == "expanding disks", + ClusterStatus::Restarting => *other == "restarting", + ClusterStatus::Available => *other == "available", + ClusterStatus::Defunct => *other == "defunct", + ClusterStatus::Inconsistent => *other == "inconsistent", + ClusterStatus::DeletingInstances => *other == "deleting instances", + ClusterStatus::InstancesDeleted => *other == "instances deleted", + ClusterStatus::DeletingDisks => *other == "deleting disks", + ClusterStatus::Deleted => *other == "deleted", + } + } +} +impl std::cmp::PartialEq for &str { + fn eq(&self, other: &ClusterStatus) -> bool { + other == self + } } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreateBackupRequest { pub description: String, pub source_cluster_id: ClusterId, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreateBackupResponse { pub id: BackupId, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreateClusterRequest { pub description: String, @@ -86,15 +152,17 @@ pub struct CreateClusterRequest { #[serde(skip_serializing_if = "Option::is_none")] pub source_node_index: Option, pub topology: Topology, + #[serde(skip_serializing_if = "Option::is_none")] + pub protected: Option, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreateClusterResponse { pub id: ClusterId, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ExpandClusterDiskRequest { pub disk_size_gb: i32, @@ -108,20 +176,20 @@ pub struct ExpandClusterDiskRequest { pub type Fields = HashMap; -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct GetBackupResponse { pub backup: Backup, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct GetClusterResponse { pub cluster: Cluster, } /// The health of the database -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] pub enum Health { #[serde(rename = "degraded")] Degraded, @@ -145,21 +213,37 @@ impl std::fmt::Display for Health { } } } +impl std::cmp::PartialEq<&str> for Health { + fn eq(&self, other: &&str) -> bool { + match self { + Health::Degraded => *other == "degraded", + Health::Down => *other == "down", + Health::HealthReportingError => *other == "health-reporting-error", + Health::Ok => *other == "ok", + Health::IssuesDetected => *other == "issues-detected", + } + } +} +impl std::cmp::PartialEq for &str { + fn eq(&self, other: &Health) -> bool { + other == self + } +} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ListBackupsResponse { pub backups: Vec, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ListClustersResponse { pub clusters: Vec, } /// The projection level of your database. Can be off, system or user -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub enum ProjectionLevel { Off, @@ -175,9 +259,29 @@ impl std::fmt::Display for ProjectionLevel { } } } +impl std::cmp::PartialEq<&str> for ProjectionLevel { + fn eq(&self, other: &&str) -> bool { + match self { + ProjectionLevel::Off => *other == "off", + ProjectionLevel::System => *other == "system", + ProjectionLevel::User => *other == "user", + } + } +} +impl std::cmp::PartialEq for &str { + fn eq(&self, other: &ProjectionLevel) -> bool { + other == self + } +} + +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct RestartClusterResponse { + pub id: String, +} /// Either single-node or three-node-multi-zone -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] pub enum Topology { #[serde(rename = "single-node")] SingleNode, @@ -192,9 +296,25 @@ impl std::fmt::Display for Topology { } } } +impl std::cmp::PartialEq<&str> for Topology { + fn eq(&self, other: &&str) -> bool { + match self { + Topology::SingleNode => *other == "single-node", + Topology::ThreeNodeMultiZone => *other == "three-node-multi-zone", + } + } +} +impl std::cmp::PartialEq for &str { + fn eq(&self, other: &Topology) -> bool { + other == self + } +} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct UpdateClusterRequest { - pub description: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub protected: Option, } diff --git a/generated/src/orchestrate/schemas.rs b/generated/src/orchestrate/schemas.rs index 9427f0d..c8b7f05 100644 --- a/generated/src/orchestrate/schemas.rs +++ b/generated/src/orchestrate/schemas.rs @@ -6,7 +6,7 @@ use chrono::DateTime; use chrono::Utc; use std::collections::HashMap; -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreateJobRequest { #[serde(flatten)] @@ -15,7 +15,7 @@ pub struct CreateJobRequest { pub schedule: String, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreateJobResponse { pub id: JobId, @@ -23,19 +23,19 @@ pub struct CreateJobResponse { pub type Fields = HashMap; -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct GetHistoryResponse { pub items: Vec, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct GetJobResponse { pub job: Job, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct HistoryItem { pub details: String, @@ -50,7 +50,7 @@ pub struct HistoryItem { pub status: String, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Job { #[serde(flatten)] @@ -63,13 +63,13 @@ pub struct Job { pub status: String, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(tag = "type", content = "data")] pub enum JobData { ScheduledBackup(ScheduledBackupData), } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] pub enum JobType { ScheduledBackup, } @@ -80,21 +80,33 @@ impl std::fmt::Display for JobType { } } } +impl std::cmp::PartialEq<&str> for JobType { + fn eq(&self, other: &&str) -> bool { + match self { + JobType::ScheduledBackup => *other == "ScheduledBackup", + } + } +} +impl std::cmp::PartialEq for &str { + fn eq(&self, other: &JobType) -> bool { + other == self + } +} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ListJobsResponse { pub jobs: Vec, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct RunJobResponse { #[serde(skip_serializing_if = "Option::is_none")] pub history_id: Option, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ScheduledBackupData { pub cluster_id: ClusterId, diff --git a/generated/src/resources/schemas.rs b/generated/src/resources/schemas.rs index 20d6612..6261afe 100644 --- a/generated/src/resources/schemas.rs +++ b/generated/src/resources/schemas.rs @@ -3,25 +3,25 @@ use chrono::DateTime; use chrono::Utc; use std::collections::HashMap; -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreateOrganizationRequest { pub name: String, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreateOrganizationResponse { pub id: OrganizationId, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreateProjectRequest { pub name: String, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CreateProjectResponse { pub id: ProjectId, @@ -29,31 +29,31 @@ pub struct CreateProjectResponse { pub type Fields = HashMap; -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct GetOrganizationResponse { pub organization: Organization, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct GetProjectResponse { pub project: Project, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ListOrganizationsResponse { pub organizations: Vec, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ListProjectsResponse { pub projects: Vec, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Organization { pub created: DateTime, @@ -62,7 +62,7 @@ pub struct Organization { pub provisioning_enabled: bool, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Project { pub created: DateTime, @@ -71,13 +71,13 @@ pub struct Project { pub organization_id: OrganizationId, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct UpdateOrganizationRequest { pub name: String, } -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct UpdateProjectRequest { pub name: String,