use crate::proto::pethost::panel::v1 as wire;
use crate::types;
fn present<T: Default + PartialEq>(value: T) -> Option<T> {
(value != T::default()).then_some(value)
}
pub(crate) fn alert_channel_kind_from_wire(value: buffa::EnumValue<wire::AlertChannelKind>) -> types::AlertChannelKind {
match value {
buffa::EnumValue::Known(wire::AlertChannelKind::ALERT_CHANNEL_KIND_UNSPECIFIED) => {
types::AlertChannelKind::Unspecified
}
buffa::EnumValue::Known(wire::AlertChannelKind::ALERT_CHANNEL_KIND_EMAIL) => types::AlertChannelKind::Email,
buffa::EnumValue::Known(wire::AlertChannelKind::ALERT_CHANNEL_KIND_TELEGRAM) => {
types::AlertChannelKind::Telegram
}
buffa::EnumValue::Known(wire::AlertChannelKind::ALERT_CHANNEL_KIND_SLACK) => types::AlertChannelKind::Slack,
buffa::EnumValue::Unknown(number) => types::AlertChannelKind::Unrecognized(number),
}
}
pub(crate) fn alert_channel_kind_to_wire(value: types::AlertChannelKind) -> buffa::EnumValue<wire::AlertChannelKind> {
match value {
types::AlertChannelKind::Unspecified => {
buffa::EnumValue::Known(wire::AlertChannelKind::ALERT_CHANNEL_KIND_UNSPECIFIED)
}
types::AlertChannelKind::Email => buffa::EnumValue::Known(wire::AlertChannelKind::ALERT_CHANNEL_KIND_EMAIL),
types::AlertChannelKind::Telegram => {
buffa::EnumValue::Known(wire::AlertChannelKind::ALERT_CHANNEL_KIND_TELEGRAM)
}
types::AlertChannelKind::Slack => buffa::EnumValue::Known(wire::AlertChannelKind::ALERT_CHANNEL_KIND_SLACK),
types::AlertChannelKind::Unrecognized(number) => buffa::EnumValue::from(number),
}
}
pub(crate) fn machine_session_kind_from_wire(
value: buffa::EnumValue<wire::MachineSessionKind>,
) -> types::MachineSessionKind {
match value {
buffa::EnumValue::Known(wire::MachineSessionKind::MACHINE_SESSION_KIND_UNSPECIFIED) => {
types::MachineSessionKind::Unspecified
}
buffa::EnumValue::Known(wire::MachineSessionKind::MACHINE_SESSION_KIND_WEB_TERMINAL) => {
types::MachineSessionKind::WebTerminal
}
buffa::EnumValue::Known(wire::MachineSessionKind::MACHINE_SESSION_KIND_SSH_TERMINAL) => {
types::MachineSessionKind::SshTerminal
}
buffa::EnumValue::Known(wire::MachineSessionKind::MACHINE_SESSION_KIND_SSH_COMMAND) => {
types::MachineSessionKind::SshCommand
}
buffa::EnumValue::Known(wire::MachineSessionKind::MACHINE_SESSION_KIND_SFTP) => types::MachineSessionKind::Sftp,
buffa::EnumValue::Known(wire::MachineSessionKind::MACHINE_SESSION_KIND_TUNNEL) => {
types::MachineSessionKind::Tunnel
}
buffa::EnumValue::Known(wire::MachineSessionKind::MACHINE_SESSION_KIND_DATABASE_CLIENT) => {
types::MachineSessionKind::DatabaseClient
}
buffa::EnumValue::Unknown(number) => types::MachineSessionKind::Unrecognized(number),
}
}
pub(crate) fn machine_session_kind_to_wire(
value: types::MachineSessionKind,
) -> buffa::EnumValue<wire::MachineSessionKind> {
match value {
types::MachineSessionKind::Unspecified => {
buffa::EnumValue::Known(wire::MachineSessionKind::MACHINE_SESSION_KIND_UNSPECIFIED)
}
types::MachineSessionKind::WebTerminal => {
buffa::EnumValue::Known(wire::MachineSessionKind::MACHINE_SESSION_KIND_WEB_TERMINAL)
}
types::MachineSessionKind::SshTerminal => {
buffa::EnumValue::Known(wire::MachineSessionKind::MACHINE_SESSION_KIND_SSH_TERMINAL)
}
types::MachineSessionKind::SshCommand => {
buffa::EnumValue::Known(wire::MachineSessionKind::MACHINE_SESSION_KIND_SSH_COMMAND)
}
types::MachineSessionKind::Sftp => buffa::EnumValue::Known(wire::MachineSessionKind::MACHINE_SESSION_KIND_SFTP),
types::MachineSessionKind::Tunnel => {
buffa::EnumValue::Known(wire::MachineSessionKind::MACHINE_SESSION_KIND_TUNNEL)
}
types::MachineSessionKind::DatabaseClient => {
buffa::EnumValue::Known(wire::MachineSessionKind::MACHINE_SESSION_KIND_DATABASE_CLIENT)
}
types::MachineSessionKind::Unrecognized(number) => buffa::EnumValue::from(number),
}
}
pub(crate) fn project_problem_kind_from_wire(
value: buffa::EnumValue<wire::ProjectProblemKind>,
) -> types::ProjectProblemKind {
match value {
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_UNSPECIFIED) => {
types::ProjectProblemKind::Unspecified
}
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_DEPLOY_FAILED) => {
types::ProjectProblemKind::DeployFailed
}
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_SERVICE_UNHEALTHY) => {
types::ProjectProblemKind::ServiceUnhealthy
}
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_SERVICE_RESTARTING) => {
types::ProjectProblemKind::ServiceRestarting
}
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_SERVICE_OUT_OF_MEMORY) => {
types::ProjectProblemKind::ServiceOutOfMemory
}
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_BACKUP_FAILED) => {
types::ProjectProblemKind::BackupFailed
}
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_DEPLOY_CANCELLED) => {
types::ProjectProblemKind::DeployCancelled
}
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_SERVICE_EXITED) => {
types::ProjectProblemKind::ServiceExited
}
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_RESTORE_FAILED) => {
types::ProjectProblemKind::RestoreFailed
}
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_AUTO_DEPLOY_REFUSED) => {
types::ProjectProblemKind::AutoDeployRefused
}
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_SERVICE_PORT_CLOSED) => {
types::ProjectProblemKind::ServicePortClosed
}
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_SITE_DOWN) => {
types::ProjectProblemKind::SiteDown
}
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_HTTP_ERRORS) => {
types::ProjectProblemKind::HttpErrors
}
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_HTTP_SLOW) => {
types::ProjectProblemKind::HttpSlow
}
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_DATABASE_SETUP) => {
types::ProjectProblemKind::DatabaseSetup
}
buffa::EnumValue::Unknown(number) => types::ProjectProblemKind::Unrecognized(number),
}
}
pub(crate) fn project_problem_kind_to_wire(
value: types::ProjectProblemKind,
) -> buffa::EnumValue<wire::ProjectProblemKind> {
match value {
types::ProjectProblemKind::Unspecified => {
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_UNSPECIFIED)
}
types::ProjectProblemKind::DeployFailed => {
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_DEPLOY_FAILED)
}
types::ProjectProblemKind::ServiceUnhealthy => {
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_SERVICE_UNHEALTHY)
}
types::ProjectProblemKind::ServiceRestarting => {
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_SERVICE_RESTARTING)
}
types::ProjectProblemKind::ServiceOutOfMemory => {
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_SERVICE_OUT_OF_MEMORY)
}
types::ProjectProblemKind::BackupFailed => {
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_BACKUP_FAILED)
}
types::ProjectProblemKind::DeployCancelled => {
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_DEPLOY_CANCELLED)
}
types::ProjectProblemKind::ServiceExited => {
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_SERVICE_EXITED)
}
types::ProjectProblemKind::RestoreFailed => {
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_RESTORE_FAILED)
}
types::ProjectProblemKind::AutoDeployRefused => {
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_AUTO_DEPLOY_REFUSED)
}
types::ProjectProblemKind::ServicePortClosed => {
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_SERVICE_PORT_CLOSED)
}
types::ProjectProblemKind::SiteDown => {
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_SITE_DOWN)
}
types::ProjectProblemKind::HttpErrors => {
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_HTTP_ERRORS)
}
types::ProjectProblemKind::HttpSlow => {
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_HTTP_SLOW)
}
types::ProjectProblemKind::DatabaseSetup => {
buffa::EnumValue::Known(wire::ProjectProblemKind::PROJECT_PROBLEM_KIND_DATABASE_SETUP)
}
types::ProjectProblemKind::Unrecognized(number) => buffa::EnumValue::from(number),
}
}
pub(crate) fn services_action_kind_from_wire(
value: buffa::EnumValue<wire::ServicesActionKind>,
) -> types::ServicesActionKind {
match value {
buffa::EnumValue::Known(wire::ServicesActionKind::SERVICES_ACTION_KIND_UNSPECIFIED) => {
types::ServicesActionKind::Unspecified
}
buffa::EnumValue::Known(wire::ServicesActionKind::SERVICES_ACTION_KIND_START) => {
types::ServicesActionKind::Start
}
buffa::EnumValue::Known(wire::ServicesActionKind::SERVICES_ACTION_KIND_STOP) => types::ServicesActionKind::Stop,
buffa::EnumValue::Known(wire::ServicesActionKind::SERVICES_ACTION_KIND_RESTART) => {
types::ServicesActionKind::Restart
}
buffa::EnumValue::Unknown(number) => types::ServicesActionKind::Unrecognized(number),
}
}
pub(crate) fn services_action_kind_to_wire(
value: types::ServicesActionKind,
) -> buffa::EnumValue<wire::ServicesActionKind> {
match value {
types::ServicesActionKind::Unspecified => {
buffa::EnumValue::Known(wire::ServicesActionKind::SERVICES_ACTION_KIND_UNSPECIFIED)
}
types::ServicesActionKind::Start => {
buffa::EnumValue::Known(wire::ServicesActionKind::SERVICES_ACTION_KIND_START)
}
types::ServicesActionKind::Stop => buffa::EnumValue::Known(wire::ServicesActionKind::SERVICES_ACTION_KIND_STOP),
types::ServicesActionKind::Restart => {
buffa::EnumValue::Known(wire::ServicesActionKind::SERVICES_ACTION_KIND_RESTART)
}
types::ServicesActionKind::Unrecognized(number) => buffa::EnumValue::from(number),
}
}
pub(crate) fn service_state_from_wire(value: buffa::EnumValue<wire::ServiceState>) -> types::ServiceState {
match value {
buffa::EnumValue::Known(wire::ServiceState::SERVICE_STATE_UNSPECIFIED) => types::ServiceState::Unspecified,
buffa::EnumValue::Known(wire::ServiceState::SERVICE_STATE_NOT_CREATED) => types::ServiceState::NotCreated,
buffa::EnumValue::Known(wire::ServiceState::SERVICE_STATE_STARTING) => types::ServiceState::Starting,
buffa::EnumValue::Known(wire::ServiceState::SERVICE_STATE_RUNNING) => types::ServiceState::Running,
buffa::EnumValue::Known(wire::ServiceState::SERVICE_STATE_HEALTHY) => types::ServiceState::Healthy,
buffa::EnumValue::Known(wire::ServiceState::SERVICE_STATE_UNHEALTHY) => types::ServiceState::Unhealthy,
buffa::EnumValue::Known(wire::ServiceState::SERVICE_STATE_RESTARTING) => types::ServiceState::Restarting,
buffa::EnumValue::Known(wire::ServiceState::SERVICE_STATE_STOPPED) => types::ServiceState::Stopped,
buffa::EnumValue::Known(wire::ServiceState::SERVICE_STATE_EXITED) => types::ServiceState::Exited,
buffa::EnumValue::Unknown(number) => types::ServiceState::Unrecognized(number),
}
}
pub(crate) fn service_state_to_wire(value: types::ServiceState) -> buffa::EnumValue<wire::ServiceState> {
match value {
types::ServiceState::Unspecified => buffa::EnumValue::Known(wire::ServiceState::SERVICE_STATE_UNSPECIFIED),
types::ServiceState::NotCreated => buffa::EnumValue::Known(wire::ServiceState::SERVICE_STATE_NOT_CREATED),
types::ServiceState::Starting => buffa::EnumValue::Known(wire::ServiceState::SERVICE_STATE_STARTING),
types::ServiceState::Running => buffa::EnumValue::Known(wire::ServiceState::SERVICE_STATE_RUNNING),
types::ServiceState::Healthy => buffa::EnumValue::Known(wire::ServiceState::SERVICE_STATE_HEALTHY),
types::ServiceState::Unhealthy => buffa::EnumValue::Known(wire::ServiceState::SERVICE_STATE_UNHEALTHY),
types::ServiceState::Restarting => buffa::EnumValue::Known(wire::ServiceState::SERVICE_STATE_RESTARTING),
types::ServiceState::Stopped => buffa::EnumValue::Known(wire::ServiceState::SERVICE_STATE_STOPPED),
types::ServiceState::Exited => buffa::EnumValue::Known(wire::ServiceState::SERVICE_STATE_EXITED),
types::ServiceState::Unrecognized(number) => buffa::EnumValue::from(number),
}
}
pub(crate) fn restart_policy_from_wire(value: buffa::EnumValue<wire::RestartPolicy>) -> types::RestartPolicy {
match value {
buffa::EnumValue::Known(wire::RestartPolicy::RESTART_POLICY_UNSPECIFIED) => types::RestartPolicy::Unspecified,
buffa::EnumValue::Known(wire::RestartPolicy::RESTART_POLICY_NO) => types::RestartPolicy::No,
buffa::EnumValue::Known(wire::RestartPolicy::RESTART_POLICY_ON_FAILURE) => types::RestartPolicy::OnFailure,
buffa::EnumValue::Known(wire::RestartPolicy::RESTART_POLICY_UNLESS_STOPPED) => {
types::RestartPolicy::UnlessStopped
}
buffa::EnumValue::Known(wire::RestartPolicy::RESTART_POLICY_ALWAYS) => types::RestartPolicy::Always,
buffa::EnumValue::Unknown(number) => types::RestartPolicy::Unrecognized(number),
}
}
pub(crate) fn restart_policy_to_wire(value: types::RestartPolicy) -> buffa::EnumValue<wire::RestartPolicy> {
match value {
types::RestartPolicy::Unspecified => buffa::EnumValue::Known(wire::RestartPolicy::RESTART_POLICY_UNSPECIFIED),
types::RestartPolicy::No => buffa::EnumValue::Known(wire::RestartPolicy::RESTART_POLICY_NO),
types::RestartPolicy::OnFailure => buffa::EnumValue::Known(wire::RestartPolicy::RESTART_POLICY_ON_FAILURE),
types::RestartPolicy::UnlessStopped => {
buffa::EnumValue::Known(wire::RestartPolicy::RESTART_POLICY_UNLESS_STOPPED)
}
types::RestartPolicy::Always => buffa::EnumValue::Known(wire::RestartPolicy::RESTART_POLICY_ALWAYS),
types::RestartPolicy::Unrecognized(number) => buffa::EnumValue::from(number),
}
}
pub(crate) fn health_status_from_wire(value: buffa::EnumValue<wire::HealthStatus>) -> types::HealthStatus {
match value {
buffa::EnumValue::Known(wire::HealthStatus::HEALTH_STATUS_UNSPECIFIED) => types::HealthStatus::Unspecified,
buffa::EnumValue::Known(wire::HealthStatus::HEALTH_STATUS_STARTING) => types::HealthStatus::Starting,
buffa::EnumValue::Known(wire::HealthStatus::HEALTH_STATUS_HEALTHY) => types::HealthStatus::Healthy,
buffa::EnumValue::Known(wire::HealthStatus::HEALTH_STATUS_UNHEALTHY) => types::HealthStatus::Unhealthy,
buffa::EnumValue::Unknown(number) => types::HealthStatus::Unrecognized(number),
}
}
pub(crate) fn health_status_to_wire(value: types::HealthStatus) -> buffa::EnumValue<wire::HealthStatus> {
match value {
types::HealthStatus::Unspecified => buffa::EnumValue::Known(wire::HealthStatus::HEALTH_STATUS_UNSPECIFIED),
types::HealthStatus::Starting => buffa::EnumValue::Known(wire::HealthStatus::HEALTH_STATUS_STARTING),
types::HealthStatus::Healthy => buffa::EnumValue::Known(wire::HealthStatus::HEALTH_STATUS_HEALTHY),
types::HealthStatus::Unhealthy => buffa::EnumValue::Known(wire::HealthStatus::HEALTH_STATUS_UNHEALTHY),
types::HealthStatus::Unrecognized(number) => buffa::EnumValue::from(number),
}
}
pub(crate) fn certificate_source_from_wire(
value: buffa::EnumValue<wire::CertificateSource>,
) -> types::CertificateSource {
match value {
buffa::EnumValue::Known(wire::CertificateSource::CERTIFICATE_SOURCE_UNSPECIFIED) => {
types::CertificateSource::Unspecified
}
buffa::EnumValue::Known(wire::CertificateSource::CERTIFICATE_SOURCE_NONE) => types::CertificateSource::None,
buffa::EnumValue::Known(wire::CertificateSource::CERTIFICATE_SOURCE_INSTALLED) => {
types::CertificateSource::Installed
}
buffa::EnumValue::Known(wire::CertificateSource::CERTIFICATE_SOURCE_AUTOMATIC) => {
types::CertificateSource::Automatic
}
buffa::EnumValue::Unknown(number) => types::CertificateSource::Unrecognized(number),
}
}
pub(crate) fn certificate_source_to_wire(value: types::CertificateSource) -> buffa::EnumValue<wire::CertificateSource> {
match value {
types::CertificateSource::Unspecified => {
buffa::EnumValue::Known(wire::CertificateSource::CERTIFICATE_SOURCE_UNSPECIFIED)
}
types::CertificateSource::None => buffa::EnumValue::Known(wire::CertificateSource::CERTIFICATE_SOURCE_NONE),
types::CertificateSource::Installed => {
buffa::EnumValue::Known(wire::CertificateSource::CERTIFICATE_SOURCE_INSTALLED)
}
types::CertificateSource::Automatic => {
buffa::EnumValue::Known(wire::CertificateSource::CERTIFICATE_SOURCE_AUTOMATIC)
}
types::CertificateSource::Unrecognized(number) => buffa::EnumValue::from(number),
}
}
pub(crate) fn operation_kind_from_wire(value: buffa::EnumValue<wire::OperationKind>) -> types::OperationKind {
match value {
buffa::EnumValue::Known(wire::OperationKind::OPERATION_KIND_UNSPECIFIED) => types::OperationKind::Unspecified,
buffa::EnumValue::Known(wire::OperationKind::OPERATION_KIND_DEPLOY) => types::OperationKind::Deploy,
buffa::EnumValue::Known(wire::OperationKind::OPERATION_KIND_RECREATE_SERVICE) => {
types::OperationKind::RecreateService
}
buffa::EnumValue::Known(wire::OperationKind::OPERATION_KIND_BACKUP) => types::OperationKind::Backup,
buffa::EnumValue::Known(wire::OperationKind::OPERATION_KIND_RESTORE) => types::OperationKind::Restore,
buffa::EnumValue::Known(wire::OperationKind::OPERATION_KIND_DELETE) => types::OperationKind::Delete,
buffa::EnumValue::Unknown(number) => types::OperationKind::Unrecognized(number),
}
}
pub(crate) fn operation_kind_to_wire(value: types::OperationKind) -> buffa::EnumValue<wire::OperationKind> {
match value {
types::OperationKind::Unspecified => buffa::EnumValue::Known(wire::OperationKind::OPERATION_KIND_UNSPECIFIED),
types::OperationKind::Deploy => buffa::EnumValue::Known(wire::OperationKind::OPERATION_KIND_DEPLOY),
types::OperationKind::RecreateService => {
buffa::EnumValue::Known(wire::OperationKind::OPERATION_KIND_RECREATE_SERVICE)
}
types::OperationKind::Backup => buffa::EnumValue::Known(wire::OperationKind::OPERATION_KIND_BACKUP),
types::OperationKind::Restore => buffa::EnumValue::Known(wire::OperationKind::OPERATION_KIND_RESTORE),
types::OperationKind::Delete => buffa::EnumValue::Known(wire::OperationKind::OPERATION_KIND_DELETE),
types::OperationKind::Unrecognized(number) => buffa::EnumValue::from(number),
}
}
pub(crate) fn operation_status_from_wire(value: buffa::EnumValue<wire::OperationStatus>) -> types::OperationStatus {
match value {
buffa::EnumValue::Known(wire::OperationStatus::OPERATION_STATUS_UNSPECIFIED) => {
types::OperationStatus::Unspecified
}
buffa::EnumValue::Known(wire::OperationStatus::OPERATION_STATUS_IN_PROGRESS) => {
types::OperationStatus::InProgress
}
buffa::EnumValue::Known(wire::OperationStatus::OPERATION_STATUS_SUCCEEDED) => types::OperationStatus::Succeeded,
buffa::EnumValue::Known(wire::OperationStatus::OPERATION_STATUS_FAILED) => types::OperationStatus::Failed,
buffa::EnumValue::Known(wire::OperationStatus::OPERATION_STATUS_CANCELLED) => types::OperationStatus::Cancelled,
buffa::EnumValue::Unknown(number) => types::OperationStatus::Unrecognized(number),
}
}
pub(crate) fn operation_status_to_wire(value: types::OperationStatus) -> buffa::EnumValue<wire::OperationStatus> {
match value {
types::OperationStatus::Unspecified => {
buffa::EnumValue::Known(wire::OperationStatus::OPERATION_STATUS_UNSPECIFIED)
}
types::OperationStatus::InProgress => {
buffa::EnumValue::Known(wire::OperationStatus::OPERATION_STATUS_IN_PROGRESS)
}
types::OperationStatus::Succeeded => buffa::EnumValue::Known(wire::OperationStatus::OPERATION_STATUS_SUCCEEDED),
types::OperationStatus::Failed => buffa::EnumValue::Known(wire::OperationStatus::OPERATION_STATUS_FAILED),
types::OperationStatus::Cancelled => buffa::EnumValue::Known(wire::OperationStatus::OPERATION_STATUS_CANCELLED),
types::OperationStatus::Unrecognized(number) => buffa::EnumValue::from(number),
}
}
pub(crate) fn deploy_failure_reason_from_wire(
value: buffa::EnumValue<wire::DeployFailureReason>,
) -> types::DeployFailureReason {
match value {
buffa::EnumValue::Known(wire::DeployFailureReason::DEPLOY_FAILURE_REASON_UNSPECIFIED) => {
types::DeployFailureReason::Unspecified
}
buffa::EnumValue::Known(wire::DeployFailureReason::DEPLOY_FAILURE_REASON_IMAGE_PULL_FAILED) => {
types::DeployFailureReason::ImagePullFailed
}
buffa::EnumValue::Known(wire::DeployFailureReason::DEPLOY_FAILURE_REASON_IMAGE_BUILD_FAILED) => {
types::DeployFailureReason::ImageBuildFailed
}
buffa::EnumValue::Known(wire::DeployFailureReason::DEPLOY_FAILURE_REASON_CONTAINER_START_FAILED) => {
types::DeployFailureReason::ContainerStartFailed
}
buffa::EnumValue::Known(wire::DeployFailureReason::DEPLOY_FAILURE_REASON_DISK_FULL) => {
types::DeployFailureReason::DiskFull
}
buffa::EnumValue::Known(wire::DeployFailureReason::DEPLOY_FAILURE_REASON_INTERNAL) => {
types::DeployFailureReason::Internal
}
buffa::EnumValue::Known(wire::DeployFailureReason::DEPLOY_FAILURE_REASON_PORT_UNAVAILABLE) => {
types::DeployFailureReason::PortUnavailable
}
buffa::EnumValue::Known(wire::DeployFailureReason::DEPLOY_FAILURE_REASON_CONTAINER_EXITED) => {
types::DeployFailureReason::ContainerExited
}
buffa::EnumValue::Known(wire::DeployFailureReason::DEPLOY_FAILURE_REASON_CONTAINER_UNHEALTHY) => {
types::DeployFailureReason::ContainerUnhealthy
}
buffa::EnumValue::Known(wire::DeployFailureReason::DEPLOY_FAILURE_REASON_TIMED_OUT) => {
types::DeployFailureReason::TimedOut
}
buffa::EnumValue::Known(wire::DeployFailureReason::DEPLOY_FAILURE_REASON_UNCOVERED_IMAGE_VOLUME) => {
types::DeployFailureReason::UncoveredImageVolume
}
buffa::EnumValue::Known(wire::DeployFailureReason::DEPLOY_FAILURE_REASON_BUILD_MEMORY_UNAVAILABLE) => {
types::DeployFailureReason::BuildMemoryUnavailable
}
buffa::EnumValue::Unknown(number) => types::DeployFailureReason::Unrecognized(number),
}
}
pub(crate) fn deploy_failure_reason_to_wire(
value: types::DeployFailureReason,
) -> buffa::EnumValue<wire::DeployFailureReason> {
match value {
types::DeployFailureReason::Unspecified => {
buffa::EnumValue::Known(wire::DeployFailureReason::DEPLOY_FAILURE_REASON_UNSPECIFIED)
}
types::DeployFailureReason::ImagePullFailed => {
buffa::EnumValue::Known(wire::DeployFailureReason::DEPLOY_FAILURE_REASON_IMAGE_PULL_FAILED)
}
types::DeployFailureReason::ImageBuildFailed => {
buffa::EnumValue::Known(wire::DeployFailureReason::DEPLOY_FAILURE_REASON_IMAGE_BUILD_FAILED)
}
types::DeployFailureReason::ContainerStartFailed => {
buffa::EnumValue::Known(wire::DeployFailureReason::DEPLOY_FAILURE_REASON_CONTAINER_START_FAILED)
}
types::DeployFailureReason::DiskFull => {
buffa::EnumValue::Known(wire::DeployFailureReason::DEPLOY_FAILURE_REASON_DISK_FULL)
}
types::DeployFailureReason::Internal => {
buffa::EnumValue::Known(wire::DeployFailureReason::DEPLOY_FAILURE_REASON_INTERNAL)
}
types::DeployFailureReason::PortUnavailable => {
buffa::EnumValue::Known(wire::DeployFailureReason::DEPLOY_FAILURE_REASON_PORT_UNAVAILABLE)
}
types::DeployFailureReason::ContainerExited => {
buffa::EnumValue::Known(wire::DeployFailureReason::DEPLOY_FAILURE_REASON_CONTAINER_EXITED)
}
types::DeployFailureReason::ContainerUnhealthy => {
buffa::EnumValue::Known(wire::DeployFailureReason::DEPLOY_FAILURE_REASON_CONTAINER_UNHEALTHY)
}
types::DeployFailureReason::TimedOut => {
buffa::EnumValue::Known(wire::DeployFailureReason::DEPLOY_FAILURE_REASON_TIMED_OUT)
}
types::DeployFailureReason::UncoveredImageVolume => {
buffa::EnumValue::Known(wire::DeployFailureReason::DEPLOY_FAILURE_REASON_UNCOVERED_IMAGE_VOLUME)
}
types::DeployFailureReason::BuildMemoryUnavailable => {
buffa::EnumValue::Known(wire::DeployFailureReason::DEPLOY_FAILURE_REASON_BUILD_MEMORY_UNAVAILABLE)
}
types::DeployFailureReason::Unrecognized(number) => buffa::EnumValue::from(number),
}
}
pub(crate) fn database_engine_from_wire(value: buffa::EnumValue<wire::DatabaseEngine>) -> types::DatabaseEngine {
match value {
buffa::EnumValue::Known(wire::DatabaseEngine::DATABASE_ENGINE_UNSPECIFIED) => {
types::DatabaseEngine::Unspecified
}
buffa::EnumValue::Known(wire::DatabaseEngine::DATABASE_ENGINE_POSTGRES) => types::DatabaseEngine::Postgres,
buffa::EnumValue::Known(wire::DatabaseEngine::DATABASE_ENGINE_VALKEY) => types::DatabaseEngine::Valkey,
buffa::EnumValue::Unknown(number) => types::DatabaseEngine::Unrecognized(number),
}
}
pub(crate) fn database_engine_to_wire(value: types::DatabaseEngine) -> buffa::EnumValue<wire::DatabaseEngine> {
match value {
types::DatabaseEngine::Unspecified => {
buffa::EnumValue::Known(wire::DatabaseEngine::DATABASE_ENGINE_UNSPECIFIED)
}
types::DatabaseEngine::Postgres => buffa::EnumValue::Known(wire::DatabaseEngine::DATABASE_ENGINE_POSTGRES),
types::DatabaseEngine::Valkey => buffa::EnumValue::Known(wire::DatabaseEngine::DATABASE_ENGINE_VALKEY),
types::DatabaseEngine::Unrecognized(number) => buffa::EnumValue::from(number),
}
}
pub(crate) fn traffic_metric_from_wire(value: buffa::EnumValue<wire::TrafficMetric>) -> types::TrafficMetric {
match value {
buffa::EnumValue::Known(wire::TrafficMetric::TRAFFIC_METRIC_UNSPECIFIED) => types::TrafficMetric::Unspecified,
buffa::EnumValue::Known(wire::TrafficMetric::TRAFFIC_METRIC_SERVER_ERRORS) => {
types::TrafficMetric::ServerErrors
}
buffa::EnumValue::Known(wire::TrafficMetric::TRAFFIC_METRIC_SERVER_ERROR_PERCENT) => {
types::TrafficMetric::ServerErrorPercent
}
buffa::EnumValue::Known(wire::TrafficMetric::TRAFFIC_METRIC_LATENCY_P95_MS) => {
types::TrafficMetric::LatencyP95Ms
}
buffa::EnumValue::Unknown(number) => types::TrafficMetric::Unrecognized(number),
}
}
pub(crate) fn traffic_metric_to_wire(value: types::TrafficMetric) -> buffa::EnumValue<wire::TrafficMetric> {
match value {
types::TrafficMetric::Unspecified => buffa::EnumValue::Known(wire::TrafficMetric::TRAFFIC_METRIC_UNSPECIFIED),
types::TrafficMetric::ServerErrors => {
buffa::EnumValue::Known(wire::TrafficMetric::TRAFFIC_METRIC_SERVER_ERRORS)
}
types::TrafficMetric::ServerErrorPercent => {
buffa::EnumValue::Known(wire::TrafficMetric::TRAFFIC_METRIC_SERVER_ERROR_PERCENT)
}
types::TrafficMetric::LatencyP95Ms => {
buffa::EnumValue::Known(wire::TrafficMetric::TRAFFIC_METRIC_LATENCY_P95_MS)
}
types::TrafficMetric::Unrecognized(number) => buffa::EnumValue::from(number),
}
}
pub(crate) fn alert_status_from_wire(value: buffa::EnumValue<wire::AlertStatus>) -> types::AlertStatus {
match value {
buffa::EnumValue::Known(wire::AlertStatus::ALERT_STATUS_UNSPECIFIED) => types::AlertStatus::Unspecified,
buffa::EnumValue::Known(wire::AlertStatus::ALERT_STATUS_OK) => types::AlertStatus::Ok,
buffa::EnumValue::Known(wire::AlertStatus::ALERT_STATUS_PENDING) => types::AlertStatus::Pending,
buffa::EnumValue::Known(wire::AlertStatus::ALERT_STATUS_FIRING) => types::AlertStatus::Firing,
buffa::EnumValue::Known(wire::AlertStatus::ALERT_STATUS_PAUSED) => types::AlertStatus::Paused,
buffa::EnumValue::Known(wire::AlertStatus::ALERT_STATUS_NO_DATA) => types::AlertStatus::NoData,
buffa::EnumValue::Unknown(number) => types::AlertStatus::Unrecognized(number),
}
}
pub(crate) fn alert_status_to_wire(value: types::AlertStatus) -> buffa::EnumValue<wire::AlertStatus> {
match value {
types::AlertStatus::Unspecified => buffa::EnumValue::Known(wire::AlertStatus::ALERT_STATUS_UNSPECIFIED),
types::AlertStatus::Ok => buffa::EnumValue::Known(wire::AlertStatus::ALERT_STATUS_OK),
types::AlertStatus::Pending => buffa::EnumValue::Known(wire::AlertStatus::ALERT_STATUS_PENDING),
types::AlertStatus::Firing => buffa::EnumValue::Known(wire::AlertStatus::ALERT_STATUS_FIRING),
types::AlertStatus::Paused => buffa::EnumValue::Known(wire::AlertStatus::ALERT_STATUS_PAUSED),
types::AlertStatus::NoData => buffa::EnumValue::Known(wire::AlertStatus::ALERT_STATUS_NO_DATA),
types::AlertStatus::Unrecognized(number) => buffa::EnumValue::from(number),
}
}
pub(crate) fn incident_quiet_reason_from_wire(
value: buffa::EnumValue<wire::IncidentQuietReason>,
) -> types::IncidentQuietReason {
match value {
buffa::EnumValue::Known(wire::IncidentQuietReason::INCIDENT_QUIET_REASON_UNSPECIFIED) => {
types::IncidentQuietReason::Unspecified
}
buffa::EnumValue::Known(wire::IncidentQuietReason::INCIDENT_QUIET_REASON_MUTED) => {
types::IncidentQuietReason::Muted
}
buffa::EnumValue::Known(wire::IncidentQuietReason::INCIDENT_QUIET_REASON_OFF) => {
types::IncidentQuietReason::Off
}
buffa::EnumValue::Known(wire::IncidentQuietReason::INCIDENT_QUIET_REASON_FIRST_EVALUATION) => {
types::IncidentQuietReason::FirstEvaluation
}
buffa::EnumValue::Known(wire::IncidentQuietReason::INCIDENT_QUIET_REASON_MANUAL_DEPLOY) => {
types::IncidentQuietReason::ManualDeploy
}
buffa::EnumValue::Unknown(number) => types::IncidentQuietReason::Unrecognized(number),
}
}
pub(crate) fn incident_quiet_reason_to_wire(
value: types::IncidentQuietReason,
) -> buffa::EnumValue<wire::IncidentQuietReason> {
match value {
types::IncidentQuietReason::Unspecified => {
buffa::EnumValue::Known(wire::IncidentQuietReason::INCIDENT_QUIET_REASON_UNSPECIFIED)
}
types::IncidentQuietReason::Muted => {
buffa::EnumValue::Known(wire::IncidentQuietReason::INCIDENT_QUIET_REASON_MUTED)
}
types::IncidentQuietReason::Off => {
buffa::EnumValue::Known(wire::IncidentQuietReason::INCIDENT_QUIET_REASON_OFF)
}
types::IncidentQuietReason::FirstEvaluation => {
buffa::EnumValue::Known(wire::IncidentQuietReason::INCIDENT_QUIET_REASON_FIRST_EVALUATION)
}
types::IncidentQuietReason::ManualDeploy => {
buffa::EnumValue::Known(wire::IncidentQuietReason::INCIDENT_QUIET_REASON_MANUAL_DEPLOY)
}
types::IncidentQuietReason::Unrecognized(number) => buffa::EnumValue::from(number),
}
}
pub(crate) fn output_stream_from_wire(value: buffa::EnumValue<wire::OutputStream>) -> types::OutputStream {
match value {
buffa::EnumValue::Known(wire::OutputStream::OUTPUT_STREAM_UNSPECIFIED) => types::OutputStream::Unspecified,
buffa::EnumValue::Known(wire::OutputStream::OUTPUT_STREAM_STDOUT) => types::OutputStream::Stdout,
buffa::EnumValue::Known(wire::OutputStream::OUTPUT_STREAM_STDERR) => types::OutputStream::Stderr,
buffa::EnumValue::Unknown(number) => types::OutputStream::Unrecognized(number),
}
}
pub(crate) fn output_stream_to_wire(value: types::OutputStream) -> buffa::EnumValue<wire::OutputStream> {
match value {
types::OutputStream::Unspecified => buffa::EnumValue::Known(wire::OutputStream::OUTPUT_STREAM_UNSPECIFIED),
types::OutputStream::Stdout => buffa::EnumValue::Known(wire::OutputStream::OUTPUT_STREAM_STDOUT),
types::OutputStream::Stderr => buffa::EnumValue::Known(wire::OutputStream::OUTPUT_STREAM_STDERR),
types::OutputStream::Unrecognized(number) => buffa::EnumValue::from(number),
}
}
pub(crate) fn file_type_from_wire(value: buffa::EnumValue<wire::FileType>) -> types::FileType {
match value {
buffa::EnumValue::Known(wire::FileType::FILE_TYPE_UNSPECIFIED) => types::FileType::Unspecified,
buffa::EnumValue::Known(wire::FileType::FILE_TYPE_FILE) => types::FileType::File,
buffa::EnumValue::Known(wire::FileType::FILE_TYPE_DIRECTORY) => types::FileType::Directory,
buffa::EnumValue::Known(wire::FileType::FILE_TYPE_SYMLINK) => types::FileType::Symlink,
buffa::EnumValue::Known(wire::FileType::FILE_TYPE_OTHER) => types::FileType::Other,
buffa::EnumValue::Unknown(number) => types::FileType::Unrecognized(number),
}
}
pub(crate) fn file_type_to_wire(value: types::FileType) -> buffa::EnumValue<wire::FileType> {
match value {
types::FileType::Unspecified => buffa::EnumValue::Known(wire::FileType::FILE_TYPE_UNSPECIFIED),
types::FileType::File => buffa::EnumValue::Known(wire::FileType::FILE_TYPE_FILE),
types::FileType::Directory => buffa::EnumValue::Known(wire::FileType::FILE_TYPE_DIRECTORY),
types::FileType::Symlink => buffa::EnumValue::Known(wire::FileType::FILE_TYPE_SYMLINK),
types::FileType::Other => buffa::EnumValue::Known(wire::FileType::FILE_TYPE_OTHER),
types::FileType::Unrecognized(number) => buffa::EnumValue::from(number),
}
}
pub(crate) fn file_location_from_wire(value: buffa::EnumValue<wire::FileLocation>) -> types::FileLocation {
match value {
buffa::EnumValue::Known(wire::FileLocation::FILE_LOCATION_UNSPECIFIED) => types::FileLocation::Unspecified,
buffa::EnumValue::Known(wire::FileLocation::FILE_LOCATION_CONTAINER) => types::FileLocation::Container,
buffa::EnumValue::Known(wire::FileLocation::FILE_LOCATION_VOLUME) => types::FileLocation::Volume,
buffa::EnumValue::Known(wire::FileLocation::FILE_LOCATION_PROJECT_FILES) => types::FileLocation::ProjectFiles,
buffa::EnumValue::Unknown(number) => types::FileLocation::Unrecognized(number),
}
}
pub(crate) fn file_location_to_wire(value: types::FileLocation) -> buffa::EnumValue<wire::FileLocation> {
match value {
types::FileLocation::Unspecified => buffa::EnumValue::Known(wire::FileLocation::FILE_LOCATION_UNSPECIFIED),
types::FileLocation::Container => buffa::EnumValue::Known(wire::FileLocation::FILE_LOCATION_CONTAINER),
types::FileLocation::Volume => buffa::EnumValue::Known(wire::FileLocation::FILE_LOCATION_VOLUME),
types::FileLocation::ProjectFiles => buffa::EnumValue::Known(wire::FileLocation::FILE_LOCATION_PROJECT_FILES),
types::FileLocation::Unrecognized(number) => buffa::EnumValue::from(number),
}
}
pub(crate) fn database_link_refusal_reason_from_wire(
value: buffa::EnumValue<wire::DatabaseLinkRefusalReason>,
) -> types::DatabaseLinkRefusalReason {
match value {
buffa::EnumValue::Known(wire::DatabaseLinkRefusalReason::DATABASE_LINK_REFUSAL_REASON_UNSPECIFIED) => {
types::DatabaseLinkRefusalReason::Unspecified
}
buffa::EnumValue::Known(wire::DatabaseLinkRefusalReason::DATABASE_LINK_REFUSAL_REASON_APP_IS_DATABASE) => {
types::DatabaseLinkRefusalReason::AppIsDatabase
}
buffa::EnumValue::Known(wire::DatabaseLinkRefusalReason::DATABASE_LINK_REFUSAL_REASON_SERVICE_NAME_TAKEN) => {
types::DatabaseLinkRefusalReason::ServiceNameTaken
}
buffa::EnumValue::Known(wire::DatabaseLinkRefusalReason::DATABASE_LINK_REFUSAL_REASON_TOO_MANY_LINKS) => {
types::DatabaseLinkRefusalReason::TooManyLinks
}
buffa::EnumValue::Unknown(number) => types::DatabaseLinkRefusalReason::Unrecognized(number),
}
}
pub(crate) fn database_link_refusal_reason_to_wire(
value: types::DatabaseLinkRefusalReason,
) -> buffa::EnumValue<wire::DatabaseLinkRefusalReason> {
match value {
types::DatabaseLinkRefusalReason::Unspecified => {
buffa::EnumValue::Known(wire::DatabaseLinkRefusalReason::DATABASE_LINK_REFUSAL_REASON_UNSPECIFIED)
}
types::DatabaseLinkRefusalReason::AppIsDatabase => {
buffa::EnumValue::Known(wire::DatabaseLinkRefusalReason::DATABASE_LINK_REFUSAL_REASON_APP_IS_DATABASE)
}
types::DatabaseLinkRefusalReason::ServiceNameTaken => {
buffa::EnumValue::Known(wire::DatabaseLinkRefusalReason::DATABASE_LINK_REFUSAL_REASON_SERVICE_NAME_TAKEN)
}
types::DatabaseLinkRefusalReason::TooManyLinks => {
buffa::EnumValue::Known(wire::DatabaseLinkRefusalReason::DATABASE_LINK_REFUSAL_REASON_TOO_MANY_LINKS)
}
types::DatabaseLinkRefusalReason::Unrecognized(number) => buffa::EnumValue::from(number),
}
}
pub(crate) fn no_machine_reason_from_wire(value: buffa::EnumValue<wire::NoMachineReason>) -> types::NoMachineReason {
match value {
buffa::EnumValue::Known(wire::NoMachineReason::NO_MACHINE_REASON_UNSPECIFIED) => {
types::NoMachineReason::Unspecified
}
buffa::EnumValue::Known(wire::NoMachineReason::NO_MACHINE_REASON_NO_PLAN) => types::NoMachineReason::NoPlan,
buffa::EnumValue::Known(wire::NoMachineReason::NO_MACHINE_REASON_BEING_PREPARED) => {
types::NoMachineReason::BeingPrepared
}
buffa::EnumValue::Unknown(number) => types::NoMachineReason::Unrecognized(number),
}
}
pub(crate) fn no_machine_reason_to_wire(value: types::NoMachineReason) -> buffa::EnumValue<wire::NoMachineReason> {
match value {
types::NoMachineReason::Unspecified => {
buffa::EnumValue::Known(wire::NoMachineReason::NO_MACHINE_REASON_UNSPECIFIED)
}
types::NoMachineReason::NoPlan => buffa::EnumValue::Known(wire::NoMachineReason::NO_MACHINE_REASON_NO_PLAN),
types::NoMachineReason::BeingPrepared => {
buffa::EnumValue::Known(wire::NoMachineReason::NO_MACHINE_REASON_BEING_PREPARED)
}
types::NoMachineReason::Unrecognized(number) => buffa::EnumValue::from(number),
}
}
impl From<types::GetMachineRequest> for wire::GetMachineRequest {
fn from(message: types::GetMachineRequest) -> Self {
let types::GetMachineRequest {} = message;
Self {
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::GetMachineRequest> for types::GetMachineRequest {
fn from(message: wire::GetMachineRequest) -> Self {
let wire::GetMachineRequest {
__buffa_unknown_fields: _,
} = message;
Self {}
}
}
impl From<types::GetMachineResponse> for wire::GetMachineResponse {
fn from(message: types::GetMachineResponse) -> Self {
let types::GetMachineResponse {
machine,
projects,
deleted_projects,
github,
} = message;
Self {
machine: machine.map(wire::Machine::from).into(),
projects: projects.into_iter().map(wire::ProjectSummary::from).collect(),
deleted_projects: deleted_projects.into_iter().map(wire::DeletedProject::from).collect(),
github: github.map(wire::GithubConnection::from).into(),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::GetMachineResponse> for types::GetMachineResponse {
fn from(message: wire::GetMachineResponse) -> Self {
let wire::GetMachineResponse {
machine,
projects,
deleted_projects,
github,
__buffa_unknown_fields: _,
} = message;
Self {
machine: machine.into_option().map(types::Machine::from),
projects: projects.into_iter().map(types::ProjectSummary::from).collect(),
deleted_projects: deleted_projects.into_iter().map(types::DeletedProject::from).collect(),
github: github.into_option().map(types::GithubConnection::from),
}
}
}
impl From<types::Machine> for wire::Machine {
fn from(message: types::Machine) -> Self {
let types::Machine {
name,
location,
sample_time,
cpu_used_cores,
cpu_total_cores,
memory_used_bytes,
memory_total_bytes,
disk_used_bytes,
disk_total_bytes,
disk_usage,
hostname,
ssh_host_key_fingerprint,
ssh_keys,
backups_enabled,
snapshot_list_time,
snapshot_list_failure_message,
backup_retention_hours,
acme_enabled,
apps_domain,
daemon_version,
docker_version,
boot_time,
restart_required_time,
scheduled_restart_time,
sessions,
alert_channels,
database_engines,
memory_limits_bytes,
} = message;
Self {
name: self::present(name),
location: self::present(location),
sample_time: sample_time.map(crate::timestamp::to_wire).into(),
cpu_used_cores: self::present(cpu_used_cores),
cpu_total_cores: self::present(cpu_total_cores),
memory_used_bytes: self::present(memory_used_bytes),
memory_total_bytes: self::present(memory_total_bytes),
disk_used_bytes: self::present(disk_used_bytes),
disk_total_bytes: self::present(disk_total_bytes),
disk_usage: disk_usage.map(wire::DiskUsage::from).into(),
hostname: self::present(hostname),
ssh_host_key_fingerprint: self::present(ssh_host_key_fingerprint),
ssh_keys: ssh_keys.into_iter().map(wire::SshKey::from).collect(),
backups_enabled: self::present(backups_enabled),
snapshot_list_time: snapshot_list_time.map(crate::timestamp::to_wire).into(),
snapshot_list_failure_message: self::present(snapshot_list_failure_message),
backup_retention_hours: self::present(backup_retention_hours),
acme_enabled: self::present(acme_enabled),
apps_domain: self::present(apps_domain),
daemon_version: self::present(daemon_version),
docker_version: self::present(docker_version),
boot_time: boot_time.map(crate::timestamp::to_wire).into(),
restart_required_time: restart_required_time.map(crate::timestamp::to_wire).into(),
scheduled_restart_time: scheduled_restart_time.map(crate::timestamp::to_wire).into(),
sessions: sessions.into_iter().map(wire::MachineSession::from).collect(),
alert_channels: alert_channels.into_iter().map(wire::AlertDestination::from).collect(),
database_engines: database_engines
.into_iter()
.map(wire::DatabaseEngineOffer::from)
.collect(),
memory_limits_bytes: self::present(memory_limits_bytes),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::Machine> for types::Machine {
fn from(message: wire::Machine) -> Self {
let wire::Machine {
name,
location,
sample_time,
cpu_used_cores,
cpu_total_cores,
memory_used_bytes,
memory_total_bytes,
disk_used_bytes,
disk_total_bytes,
disk_usage,
hostname,
ssh_host_key_fingerprint,
ssh_keys,
backups_enabled,
snapshot_list_time,
snapshot_list_failure_message,
backup_retention_hours,
acme_enabled,
apps_domain,
daemon_version,
docker_version,
boot_time,
restart_required_time,
scheduled_restart_time,
sessions,
alert_channels,
database_engines,
memory_limits_bytes,
__buffa_unknown_fields: _,
} = message;
Self {
name: name.unwrap_or_default(),
location: location.unwrap_or_default(),
sample_time: sample_time.into_option().map(crate::timestamp::from_wire),
cpu_used_cores: cpu_used_cores.unwrap_or_default(),
cpu_total_cores: cpu_total_cores.unwrap_or_default(),
memory_used_bytes: memory_used_bytes.unwrap_or_default(),
memory_total_bytes: memory_total_bytes.unwrap_or_default(),
disk_used_bytes: disk_used_bytes.unwrap_or_default(),
disk_total_bytes: disk_total_bytes.unwrap_or_default(),
disk_usage: disk_usage.into_option().map(types::DiskUsage::from),
hostname: hostname.unwrap_or_default(),
ssh_host_key_fingerprint: ssh_host_key_fingerprint.unwrap_or_default(),
ssh_keys: ssh_keys.into_iter().map(types::SshKey::from).collect(),
backups_enabled: backups_enabled.unwrap_or_default(),
snapshot_list_time: snapshot_list_time.into_option().map(crate::timestamp::from_wire),
snapshot_list_failure_message: snapshot_list_failure_message.unwrap_or_default(),
backup_retention_hours: backup_retention_hours.unwrap_or_default(),
acme_enabled: acme_enabled.unwrap_or_default(),
apps_domain: apps_domain.unwrap_or_default(),
daemon_version: daemon_version.unwrap_or_default(),
docker_version: docker_version.unwrap_or_default(),
boot_time: boot_time.into_option().map(crate::timestamp::from_wire),
restart_required_time: restart_required_time.into_option().map(crate::timestamp::from_wire),
scheduled_restart_time: scheduled_restart_time.into_option().map(crate::timestamp::from_wire),
sessions: sessions.into_iter().map(types::MachineSession::from).collect(),
alert_channels: alert_channels.into_iter().map(types::AlertDestination::from).collect(),
database_engines: database_engines
.into_iter()
.map(types::DatabaseEngineOffer::from)
.collect(),
memory_limits_bytes: memory_limits_bytes.unwrap_or_default(),
}
}
}
impl From<types::AlertDestination> for wire::AlertDestination {
fn from(message: types::AlertDestination) -> Self {
let types::AlertDestination { kind, label } = message;
Self {
kind: self::present(kind).map(alert_channel_kind_to_wire),
label: self::present(label),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::AlertDestination> for types::AlertDestination {
fn from(message: wire::AlertDestination) -> Self {
let wire::AlertDestination {
kind,
label,
__buffa_unknown_fields: _,
} = message;
Self {
kind: kind.map(alert_channel_kind_from_wire).unwrap_or_default(),
label: label.unwrap_or_default(),
}
}
}
impl From<types::MachineSession> for wire::MachineSession {
fn from(message: types::MachineSession) -> Self {
let types::MachineSession {
session_id,
kind,
project_id,
service,
port,
start_time,
client_address,
ssh_key_label,
ssh_key_fingerprint,
} = message;
Self {
session_id: self::present(session_id),
kind: self::present(kind).map(machine_session_kind_to_wire),
project_id: self::present(project_id),
service: self::present(service),
port: self::present(port),
start_time: start_time.map(crate::timestamp::to_wire).into(),
client_address: self::present(client_address),
ssh_key_label: self::present(ssh_key_label),
ssh_key_fingerprint: self::present(ssh_key_fingerprint),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::MachineSession> for types::MachineSession {
fn from(message: wire::MachineSession) -> Self {
let wire::MachineSession {
session_id,
kind,
project_id,
service,
port,
start_time,
client_address,
ssh_key_label,
ssh_key_fingerprint,
__buffa_unknown_fields: _,
} = message;
Self {
session_id: session_id.unwrap_or_default(),
kind: kind.map(machine_session_kind_from_wire).unwrap_or_default(),
project_id: project_id.unwrap_or_default(),
service: service.unwrap_or_default(),
port: port.unwrap_or_default(),
start_time: start_time.into_option().map(crate::timestamp::from_wire),
client_address: client_address.unwrap_or_default(),
ssh_key_label: ssh_key_label.unwrap_or_default(),
ssh_key_fingerprint: ssh_key_fingerprint.unwrap_or_default(),
}
}
}
impl From<types::DiskUsage> for wire::DiskUsage {
fn from(message: types::DiskUsage) -> Self {
let types::DiskUsage {
images_bytes,
build_cache_bytes,
volumes_bytes,
container_layers_bytes,
project_files_bytes,
container_logs_bytes,
http_traffic_bytes,
} = message;
Self {
images_bytes: self::present(images_bytes),
build_cache_bytes,
volumes_bytes: self::present(volumes_bytes),
container_layers_bytes: self::present(container_layers_bytes),
project_files_bytes: self::present(project_files_bytes),
container_logs_bytes: self::present(container_logs_bytes),
http_traffic_bytes: self::present(http_traffic_bytes),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::DiskUsage> for types::DiskUsage {
fn from(message: wire::DiskUsage) -> Self {
let wire::DiskUsage {
images_bytes,
build_cache_bytes,
volumes_bytes,
container_layers_bytes,
project_files_bytes,
container_logs_bytes,
http_traffic_bytes,
__buffa_unknown_fields: _,
} = message;
Self {
images_bytes: images_bytes.unwrap_or_default(),
build_cache_bytes,
volumes_bytes: volumes_bytes.unwrap_or_default(),
container_layers_bytes: container_layers_bytes.unwrap_or_default(),
project_files_bytes: project_files_bytes.unwrap_or_default(),
container_logs_bytes: container_logs_bytes.unwrap_or_default(),
http_traffic_bytes: http_traffic_bytes.unwrap_or_default(),
}
}
}
impl From<types::SshKey> for wire::SshKey {
fn from(message: types::SshKey) -> Self {
let types::SshKey {
public_key,
label,
fingerprint,
} = message;
Self {
public_key: self::present(public_key),
label: self::present(label),
fingerprint: self::present(fingerprint),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::SshKey> for types::SshKey {
fn from(message: wire::SshKey) -> Self {
let wire::SshKey {
public_key,
label,
fingerprint,
__buffa_unknown_fields: _,
} = message;
Self {
public_key: public_key.unwrap_or_default(),
label: label.unwrap_or_default(),
fingerprint: fingerprint.unwrap_or_default(),
}
}
}
impl From<types::GithubConnection> for wire::GithubConnection {
fn from(message: types::GithubConnection) -> Self {
let types::GithubConnection {
app_name,
install_url,
repositories,
repository_count,
webhooks_enabled,
} = message;
Self {
app_name: self::present(app_name),
install_url: self::present(install_url),
repositories: repositories.into_iter().map(wire::GithubRepository::from).collect(),
repository_count: self::present(repository_count),
webhooks_enabled: self::present(webhooks_enabled),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::GithubConnection> for types::GithubConnection {
fn from(message: wire::GithubConnection) -> Self {
let wire::GithubConnection {
app_name,
install_url,
repositories,
repository_count,
webhooks_enabled,
__buffa_unknown_fields: _,
} = message;
Self {
app_name: app_name.unwrap_or_default(),
install_url: install_url.unwrap_or_default(),
repositories: repositories.into_iter().map(types::GithubRepository::from).collect(),
repository_count: repository_count.unwrap_or_default(),
webhooks_enabled: webhooks_enabled.unwrap_or_default(),
}
}
}
impl From<types::GithubRepository> for wire::GithubRepository {
fn from(message: types::GithubRepository) -> Self {
let types::GithubRepository {
repository,
default_branch,
private,
push_time,
} = message;
Self {
repository: self::present(repository),
default_branch: self::present(default_branch),
private: self::present(private),
push_time: push_time.map(crate::timestamp::to_wire).into(),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::GithubRepository> for types::GithubRepository {
fn from(message: wire::GithubRepository) -> Self {
let wire::GithubRepository {
repository,
default_branch,
private,
push_time,
__buffa_unknown_fields: _,
} = message;
Self {
repository: repository.unwrap_or_default(),
default_branch: default_branch.unwrap_or_default(),
private: private.unwrap_or_default(),
push_time: push_time.into_option().map(crate::timestamp::from_wire),
}
}
}
impl From<types::DeletedProject> for wire::DeletedProject {
fn from(message: types::DeletedProject) -> Self {
let types::DeletedProject {
project_id,
newest_snapshot,
snapshot_count,
} = message;
Self {
project_id: self::present(project_id),
newest_snapshot: newest_snapshot.map(wire::Snapshot::from).into(),
snapshot_count: self::present(snapshot_count),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::DeletedProject> for types::DeletedProject {
fn from(message: wire::DeletedProject) -> Self {
let wire::DeletedProject {
project_id,
newest_snapshot,
snapshot_count,
__buffa_unknown_fields: _,
} = message;
Self {
project_id: project_id.unwrap_or_default(),
newest_snapshot: newest_snapshot.into_option().map(types::Snapshot::from),
snapshot_count: snapshot_count.unwrap_or_default(),
}
}
}
impl From<types::RunMachineActionRequest> for wire::RunMachineActionRequest {
fn from(message: types::RunMachineActionRequest) -> Self {
let types::RunMachineActionRequest { action } = message;
Self {
action: match action {
Some(types::RunMachineActionRequestAction::AddSshKey(value)) => {
Some(wire::__buffa::oneof::run_machine_action_request::Action::AddSshKey(
Box::new(wire::SshKey::from(value)),
))
}
Some(types::RunMachineActionRequestAction::RemoveSshKeyFingerprint(value)) => {
Some(wire::__buffa::oneof::run_machine_action_request::Action::RemoveSshKeyFingerprint(value))
}
Some(types::RunMachineActionRequestAction::RestartMachine(value)) => Some(
wire::__buffa::oneof::run_machine_action_request::Action::RestartMachine(Box::new(
wire::RestartMachineAction::from(value),
)),
),
Some(types::RunMachineActionRequestAction::CancelRestart(value)) => Some(
wire::__buffa::oneof::run_machine_action_request::Action::CancelRestart(value),
),
Some(types::RunMachineActionRequestAction::EndSessionId(value)) => Some(
wire::__buffa::oneof::run_machine_action_request::Action::EndSessionId(value),
),
None => None,
},
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::RunMachineActionRequest> for types::RunMachineActionRequest {
fn from(message: wire::RunMachineActionRequest) -> Self {
let wire::RunMachineActionRequest {
action,
__buffa_unknown_fields: _,
} = message;
Self {
action: match action {
Some(wire::__buffa::oneof::run_machine_action_request::Action::AddSshKey(value)) => Some(
types::RunMachineActionRequestAction::AddSshKey(types::SshKey::from(*value)),
),
Some(wire::__buffa::oneof::run_machine_action_request::Action::RemoveSshKeyFingerprint(value)) => {
Some(types::RunMachineActionRequestAction::RemoveSshKeyFingerprint(value))
}
Some(wire::__buffa::oneof::run_machine_action_request::Action::RestartMachine(value)) => Some(
types::RunMachineActionRequestAction::RestartMachine(types::RestartMachineAction::from(*value)),
),
Some(wire::__buffa::oneof::run_machine_action_request::Action::CancelRestart(value)) => {
Some(types::RunMachineActionRequestAction::CancelRestart(value))
}
Some(wire::__buffa::oneof::run_machine_action_request::Action::EndSessionId(value)) => {
Some(types::RunMachineActionRequestAction::EndSessionId(value))
}
None => None,
},
}
}
}
impl From<types::RestartMachineAction> for wire::RestartMachineAction {
fn from(message: types::RestartMachineAction) -> Self {
let types::RestartMachineAction {
restart_time,
at_maintenance_window,
interrupt_operations,
} = message;
Self {
restart_time: restart_time.map(crate::timestamp::to_wire).into(),
at_maintenance_window: self::present(at_maintenance_window),
interrupt_operations: self::present(interrupt_operations),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::RestartMachineAction> for types::RestartMachineAction {
fn from(message: wire::RestartMachineAction) -> Self {
let wire::RestartMachineAction {
restart_time,
at_maintenance_window,
interrupt_operations,
__buffa_unknown_fields: _,
} = message;
Self {
restart_time: restart_time.into_option().map(crate::timestamp::from_wire),
at_maintenance_window: at_maintenance_window.unwrap_or_default(),
interrupt_operations: interrupt_operations.unwrap_or_default(),
}
}
}
impl From<types::RunMachineActionResponse> for wire::RunMachineActionResponse {
fn from(message: types::RunMachineActionResponse) -> Self {
let types::RunMachineActionResponse { machine } = message;
Self {
machine: machine.map(wire::Machine::from).into(),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::RunMachineActionResponse> for types::RunMachineActionResponse {
fn from(message: wire::RunMachineActionResponse) -> Self {
let wire::RunMachineActionResponse {
machine,
__buffa_unknown_fields: _,
} = message;
Self {
machine: machine.into_option().map(types::Machine::from),
}
}
}
impl From<types::ProjectMetadata> for wire::ProjectMetadata {
fn from(message: types::ProjectMetadata) -> Self {
let types::ProjectMetadata {
name,
emoji,
description,
notes,
} = message;
Self {
name,
emoji,
description,
notes,
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::ProjectMetadata> for types::ProjectMetadata {
fn from(message: wire::ProjectMetadata) -> Self {
let wire::ProjectMetadata {
name,
emoji,
description,
notes,
__buffa_unknown_fields: _,
} = message;
Self {
name,
emoji,
description,
notes,
}
}
}
impl From<types::ProjectSummary> for wire::ProjectSummary {
fn from(message: types::ProjectSummary) -> Self {
let types::ProjectSummary {
project_id,
metadata,
problems,
services,
url,
hosts,
http_traffic_last_day,
cpu_used_cores,
memory_used_bytes,
deploy_time,
running_operations,
pinned,
disk_used_bytes,
database,
} = message;
Self {
project_id: self::present(project_id),
metadata: metadata.map(wire::ProjectMetadata::from).into(),
problems: problems.into_iter().map(wire::ProjectProblem::from).collect(),
services: services.into_iter().map(wire::ServiceSummary::from).collect(),
url: self::present(url),
hosts,
http_traffic_last_day: http_traffic_last_day.map(wire::HttpTrafficSummary::from).into(),
cpu_used_cores: self::present(cpu_used_cores),
memory_used_bytes: self::present(memory_used_bytes),
deploy_time: deploy_time.map(crate::timestamp::to_wire).into(),
running_operations: running_operations.into_iter().map(wire::Operation::from).collect(),
pinned: self::present(pinned),
disk_used_bytes: self::present(disk_used_bytes),
database: database.map(wire::DatabaseSummary::from).into(),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::ProjectSummary> for types::ProjectSummary {
fn from(message: wire::ProjectSummary) -> Self {
let wire::ProjectSummary {
project_id,
metadata,
problems,
services,
url,
hosts,
http_traffic_last_day,
cpu_used_cores,
memory_used_bytes,
deploy_time,
running_operations,
pinned,
disk_used_bytes,
database,
__buffa_unknown_fields: _,
} = message;
Self {
project_id: project_id.unwrap_or_default(),
metadata: metadata.into_option().map(types::ProjectMetadata::from),
problems: problems.into_iter().map(types::ProjectProblem::from).collect(),
services: services.into_iter().map(types::ServiceSummary::from).collect(),
url: url.unwrap_or_default(),
hosts,
http_traffic_last_day: http_traffic_last_day.into_option().map(types::HttpTrafficSummary::from),
cpu_used_cores: cpu_used_cores.unwrap_or_default(),
memory_used_bytes: memory_used_bytes.unwrap_or_default(),
deploy_time: deploy_time.into_option().map(crate::timestamp::from_wire),
running_operations: running_operations.into_iter().map(types::Operation::from).collect(),
pinned: pinned.unwrap_or_default(),
disk_used_bytes: disk_used_bytes.unwrap_or_default(),
database: database.into_option().map(types::DatabaseSummary::from),
}
}
}
impl From<types::ServiceSummary> for wire::ServiceSummary {
fn from(message: types::ServiceSummary) -> Self {
let types::ServiceSummary { service, state } = message;
Self {
service: self::present(service),
state: self::present(state).map(service_state_to_wire),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::ServiceSummary> for types::ServiceSummary {
fn from(message: wire::ServiceSummary) -> Self {
let wire::ServiceSummary {
service,
state,
__buffa_unknown_fields: _,
} = message;
Self {
service: service.unwrap_or_default(),
state: state.map(service_state_from_wire).unwrap_or_default(),
}
}
}
impl From<types::ProjectProblem> for wire::ProjectProblem {
fn from(message: types::ProjectProblem) -> Self {
let types::ProjectProblem {
kind,
service,
operation_id,
since_time,
problem_message,
incident_id,
} = message;
Self {
kind: self::present(kind).map(project_problem_kind_to_wire),
service: self::present(service),
operation_id: self::present(operation_id),
since_time: since_time.map(crate::timestamp::to_wire).into(),
problem_message: self::present(problem_message),
incident_id: self::present(incident_id),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::ProjectProblem> for types::ProjectProblem {
fn from(message: wire::ProjectProblem) -> Self {
let wire::ProjectProblem {
kind,
service,
operation_id,
since_time,
problem_message,
incident_id,
__buffa_unknown_fields: _,
} = message;
Self {
kind: kind.map(project_problem_kind_from_wire).unwrap_or_default(),
service: service.unwrap_or_default(),
operation_id: operation_id.unwrap_or_default(),
since_time: since_time.into_option().map(crate::timestamp::from_wire),
problem_message: problem_message.unwrap_or_default(),
incident_id: incident_id.unwrap_or_default(),
}
}
}
impl From<types::GetProjectRequest> for wire::GetProjectRequest {
fn from(message: types::GetProjectRequest) -> Self {
let types::GetProjectRequest {
project_id,
include_secret_values,
snapshots_before,
snapshots_volume,
incidents_before,
uptime_day_count,
incidents_before_id,
} = message;
Self {
project_id: self::present(project_id),
include_secret_values: self::present(include_secret_values),
snapshots_before: snapshots_before.map(crate::timestamp::to_wire).into(),
snapshots_volume: self::present(snapshots_volume),
incidents_before: incidents_before.map(crate::timestamp::to_wire).into(),
uptime_day_count: self::present(uptime_day_count),
incidents_before_id: self::present(incidents_before_id),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::GetProjectRequest> for types::GetProjectRequest {
fn from(message: wire::GetProjectRequest) -> Self {
let wire::GetProjectRequest {
project_id,
include_secret_values,
snapshots_before,
snapshots_volume,
incidents_before,
uptime_day_count,
incidents_before_id,
__buffa_unknown_fields: _,
} = message;
Self {
project_id: project_id.unwrap_or_default(),
include_secret_values: include_secret_values.unwrap_or_default(),
snapshots_before: snapshots_before.into_option().map(crate::timestamp::from_wire),
snapshots_volume: snapshots_volume.unwrap_or_default(),
incidents_before: incidents_before.into_option().map(crate::timestamp::from_wire),
uptime_day_count: uptime_day_count.unwrap_or_default(),
incidents_before_id: incidents_before_id.unwrap_or_default(),
}
}
}
impl From<types::GetProjectResponse> for wire::GetProjectResponse {
fn from(message: types::GetProjectResponse) -> Self {
let types::GetProjectResponse { project } = message;
Self {
project: project.map(wire::Project::from).into(),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::GetProjectResponse> for types::GetProjectResponse {
fn from(message: wire::GetProjectResponse) -> Self {
let wire::GetProjectResponse {
project,
__buffa_unknown_fields: _,
} = message;
Self {
project: project.into_option().map(types::Project::from),
}
}
}
impl From<types::Project> for wire::Project {
fn from(message: types::Project) -> Self {
let types::Project {
project_id,
metadata,
problems,
url,
cpu_used_cores,
memory_used_bytes,
deploy_id,
deploy_status,
deploy_time,
x_pethost_applies_at_once,
services,
volumes,
routes,
hosts,
password_protected,
operations,
snapshots,
snapshot_count,
snapshot_list_time,
http_traffic_last_day,
source,
running_services_action,
alerts,
incidents,
more_incidents,
uptime_days,
database,
linked_databases,
} = message;
Self {
project_id: self::present(project_id),
metadata: metadata.map(wire::ProjectMetadata::from).into(),
problems: problems.into_iter().map(wire::ProjectProblem::from).collect(),
url: self::present(url),
cpu_used_cores: self::present(cpu_used_cores),
memory_used_bytes: self::present(memory_used_bytes),
deploy_id: self::present(deploy_id),
deploy_status: self::present(deploy_status).map(operation_status_to_wire),
deploy_time: deploy_time.map(crate::timestamp::to_wire).into(),
x_pethost_applies_at_once: self::present(x_pethost_applies_at_once),
services: services.into_iter().map(wire::Service::from).collect(),
volumes: volumes.into_iter().map(wire::Volume::from).collect(),
routes: routes.into_iter().map(wire::Route::from).collect(),
hosts: hosts.into_iter().map(wire::Host::from).collect(),
password_protected: self::present(password_protected),
operations: operations.into_iter().map(wire::Operation::from).collect(),
snapshots: snapshots.into_iter().map(wire::Snapshot::from).collect(),
snapshot_count: self::present(snapshot_count),
snapshot_list_time: snapshot_list_time.map(crate::timestamp::to_wire).into(),
http_traffic_last_day: http_traffic_last_day.map(wire::HttpTrafficSummary::from).into(),
source: source.map(wire::ProjectSource::from).into(),
running_services_action: running_services_action.map(wire::RunningServicesAction::from).into(),
alerts: alerts.map(wire::ProjectAlerts::from).into(),
incidents: incidents.into_iter().map(wire::Incident::from).collect(),
more_incidents: self::present(more_incidents),
uptime_days: uptime_days.into_iter().map(wire::UptimeDay::from).collect(),
database: database.map(wire::Database::from).into(),
linked_databases,
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::Project> for types::Project {
fn from(message: wire::Project) -> Self {
let wire::Project {
project_id,
metadata,
problems,
url,
cpu_used_cores,
memory_used_bytes,
deploy_id,
deploy_status,
deploy_time,
x_pethost_applies_at_once,
services,
volumes,
routes,
hosts,
password_protected,
operations,
snapshots,
snapshot_count,
snapshot_list_time,
http_traffic_last_day,
source,
running_services_action,
alerts,
incidents,
more_incidents,
uptime_days,
database,
linked_databases,
__buffa_unknown_fields: _,
} = message;
Self {
project_id: project_id.unwrap_or_default(),
metadata: metadata.into_option().map(types::ProjectMetadata::from),
problems: problems.into_iter().map(types::ProjectProblem::from).collect(),
url: url.unwrap_or_default(),
cpu_used_cores: cpu_used_cores.unwrap_or_default(),
memory_used_bytes: memory_used_bytes.unwrap_or_default(),
deploy_id: deploy_id.unwrap_or_default(),
deploy_status: deploy_status.map(operation_status_from_wire).unwrap_or_default(),
deploy_time: deploy_time.into_option().map(crate::timestamp::from_wire),
x_pethost_applies_at_once: x_pethost_applies_at_once.unwrap_or_default(),
services: services.into_iter().map(types::Service::from).collect(),
volumes: volumes.into_iter().map(types::Volume::from).collect(),
routes: routes.into_iter().map(types::Route::from).collect(),
hosts: hosts.into_iter().map(types::Host::from).collect(),
password_protected: password_protected.unwrap_or_default(),
operations: operations.into_iter().map(types::Operation::from).collect(),
snapshots: snapshots.into_iter().map(types::Snapshot::from).collect(),
snapshot_count: snapshot_count.unwrap_or_default(),
snapshot_list_time: snapshot_list_time.into_option().map(crate::timestamp::from_wire),
http_traffic_last_day: http_traffic_last_day.into_option().map(types::HttpTrafficSummary::from),
source: source.into_option().map(types::ProjectSource::from),
running_services_action: running_services_action
.into_option()
.map(types::RunningServicesAction::from),
alerts: alerts.into_option().map(types::ProjectAlerts::from),
incidents: incidents.into_iter().map(types::Incident::from).collect(),
more_incidents: more_incidents.unwrap_or_default(),
uptime_days: uptime_days.into_iter().map(types::UptimeDay::from).collect(),
database: database.into_option().map(types::Database::from),
linked_databases,
}
}
}
impl From<types::RunningServicesAction> for wire::RunningServicesAction {
fn from(message: types::RunningServicesAction) -> Self {
let types::RunningServicesAction {
kind,
services,
start_time,
} = message;
Self {
kind: self::present(kind).map(services_action_kind_to_wire),
services,
start_time: start_time.map(crate::timestamp::to_wire).into(),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::RunningServicesAction> for types::RunningServicesAction {
fn from(message: wire::RunningServicesAction) -> Self {
let wire::RunningServicesAction {
kind,
services,
start_time,
__buffa_unknown_fields: _,
} = message;
Self {
kind: kind.map(services_action_kind_from_wire).unwrap_or_default(),
services,
start_time: start_time.into_option().map(crate::timestamp::from_wire),
}
}
}
impl From<types::ProjectSource> for wire::ProjectSource {
fn from(message: types::ProjectSource) -> Self {
let types::ProjectSource { kind } = message;
Self {
kind: match kind {
Some(types::ProjectSourceKind::Files(value)) => {
Some(wire::__buffa::oneof::project_source::Kind::Files(value))
}
Some(types::ProjectSourceKind::Github(value)) => Some(
wire::__buffa::oneof::project_source::Kind::Github(Box::new(wire::GithubSource::from(value))),
),
None | Some(types::ProjectSourceKind::Unrecognized) => None,
},
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::ProjectSource> for types::ProjectSource {
fn from(message: wire::ProjectSource) -> Self {
let wire::ProjectSource {
kind,
__buffa_unknown_fields,
} = message;
Self {
kind: match kind {
Some(wire::__buffa::oneof::project_source::Kind::Files(value)) => {
Some(types::ProjectSourceKind::Files(value))
}
Some(wire::__buffa::oneof::project_source::Kind::Github(value)) => {
Some(types::ProjectSourceKind::Github(types::GithubSource::from(*value)))
}
None if !__buffa_unknown_fields.is_empty() => Some(types::ProjectSourceKind::Unrecognized),
None => None,
},
}
}
}
impl From<types::GithubSource> for wire::GithubSource {
fn from(message: types::GithubSource) -> Self {
let types::GithubSource {
repository,
branch,
directory,
auto_deploy,
newest_commit,
deployed_commit,
pinned,
auto_deploy_pending,
} = message;
Self {
repository,
branch,
directory,
auto_deploy,
newest_commit: newest_commit.map(wire::GithubCommit::from).into(),
deployed_commit: deployed_commit.map(wire::GithubCommit::from).into(),
pinned: self::present(pinned),
auto_deploy_pending: self::present(auto_deploy_pending),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::GithubSource> for types::GithubSource {
fn from(message: wire::GithubSource) -> Self {
let wire::GithubSource {
repository,
branch,
directory,
auto_deploy,
newest_commit,
deployed_commit,
pinned,
auto_deploy_pending,
__buffa_unknown_fields: _,
} = message;
Self {
repository,
branch,
directory,
auto_deploy,
newest_commit: newest_commit.into_option().map(types::GithubCommit::from),
deployed_commit: deployed_commit.into_option().map(types::GithubCommit::from),
pinned: pinned.unwrap_or_default(),
auto_deploy_pending: auto_deploy_pending.unwrap_or_default(),
}
}
}
impl From<types::GithubCommit> for wire::GithubCommit {
fn from(message: types::GithubCommit) -> Self {
let types::GithubCommit { sha, title, url } = message;
Self {
sha: self::present(sha),
title: self::present(title),
url: self::present(url),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::GithubCommit> for types::GithubCommit {
fn from(message: wire::GithubCommit) -> Self {
let wire::GithubCommit {
sha,
title,
url,
__buffa_unknown_fields: _,
} = message;
Self {
sha: sha.unwrap_or_default(),
title: title.unwrap_or_default(),
url: url.unwrap_or_default(),
}
}
}
impl From<types::Service> for wire::Service {
fn from(message: types::Service) -> Self {
let types::Service {
service,
state,
container_running,
image,
builds_image,
image_digest,
image_size_bytes,
command,
run_as_user,
start_time,
finish_time,
exit_code,
out_of_memory,
restart_count,
cpu_used_cores,
memory_used_bytes,
memory_limit_bytes,
cpu_limit_cores,
writable_layer_bytes,
ports,
listening_ports,
published_ports,
volume_mounts,
restart_policy,
health_check,
environment,
env_files,
ssh_command,
} = message;
Self {
service: self::present(service),
state: self::present(state).map(service_state_to_wire),
container_running: self::present(container_running),
image: self::present(image),
builds_image: self::present(builds_image),
image_digest: self::present(image_digest),
image_size_bytes: self::present(image_size_bytes),
command,
run_as_user: self::present(run_as_user),
start_time: start_time.map(crate::timestamp::to_wire).into(),
finish_time: finish_time.map(crate::timestamp::to_wire).into(),
exit_code,
out_of_memory: self::present(out_of_memory),
restart_count: self::present(restart_count),
cpu_used_cores: self::present(cpu_used_cores),
memory_used_bytes: self::present(memory_used_bytes),
memory_limit_bytes: self::present(memory_limit_bytes),
cpu_limit_cores: self::present(cpu_limit_cores),
writable_layer_bytes: self::present(writable_layer_bytes),
ports,
listening_ports,
published_ports: published_ports.into_iter().map(wire::PublishedPort::from).collect(),
volume_mounts: volume_mounts.into_iter().map(wire::VolumeMount::from).collect(),
restart_policy: self::present(restart_policy).map(restart_policy_to_wire),
health_check: health_check.map(wire::HealthCheck::from).into(),
environment: environment.into_iter().map(wire::EnvironmentVariable::from).collect(),
env_files,
ssh_command: self::present(ssh_command),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::Service> for types::Service {
fn from(message: wire::Service) -> Self {
let wire::Service {
service,
state,
container_running,
image,
builds_image,
image_digest,
image_size_bytes,
command,
run_as_user,
start_time,
finish_time,
exit_code,
out_of_memory,
restart_count,
cpu_used_cores,
memory_used_bytes,
memory_limit_bytes,
cpu_limit_cores,
writable_layer_bytes,
ports,
listening_ports,
published_ports,
volume_mounts,
restart_policy,
health_check,
environment,
env_files,
ssh_command,
__buffa_unknown_fields: _,
} = message;
Self {
service: service.unwrap_or_default(),
state: state.map(service_state_from_wire).unwrap_or_default(),
container_running: container_running.unwrap_or_default(),
image: image.unwrap_or_default(),
builds_image: builds_image.unwrap_or_default(),
image_digest: image_digest.unwrap_or_default(),
image_size_bytes: image_size_bytes.unwrap_or_default(),
command,
run_as_user: run_as_user.unwrap_or_default(),
start_time: start_time.into_option().map(crate::timestamp::from_wire),
finish_time: finish_time.into_option().map(crate::timestamp::from_wire),
exit_code,
out_of_memory: out_of_memory.unwrap_or_default(),
restart_count: restart_count.unwrap_or_default(),
cpu_used_cores: cpu_used_cores.unwrap_or_default(),
memory_used_bytes: memory_used_bytes.unwrap_or_default(),
memory_limit_bytes: memory_limit_bytes.unwrap_or_default(),
cpu_limit_cores: cpu_limit_cores.unwrap_or_default(),
writable_layer_bytes: writable_layer_bytes.unwrap_or_default(),
ports,
listening_ports,
published_ports: published_ports.into_iter().map(types::PublishedPort::from).collect(),
volume_mounts: volume_mounts.into_iter().map(types::VolumeMount::from).collect(),
restart_policy: restart_policy.map(restart_policy_from_wire).unwrap_or_default(),
health_check: health_check.into_option().map(types::HealthCheck::from),
environment: environment.into_iter().map(types::EnvironmentVariable::from).collect(),
env_files,
ssh_command: ssh_command.unwrap_or_default(),
}
}
}
impl From<types::PublishedPort> for wire::PublishedPort {
fn from(message: types::PublishedPort) -> Self {
let types::PublishedPort {
machine_port,
container_port,
protocol,
} = message;
Self {
machine_port: self::present(machine_port),
container_port: self::present(container_port),
protocol: self::present(protocol),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::PublishedPort> for types::PublishedPort {
fn from(message: wire::PublishedPort) -> Self {
let wire::PublishedPort {
machine_port,
container_port,
protocol,
__buffa_unknown_fields: _,
} = message;
Self {
machine_port: machine_port.unwrap_or_default(),
container_port: container_port.unwrap_or_default(),
protocol: protocol.unwrap_or_default(),
}
}
}
impl From<types::VolumeMount> for wire::VolumeMount {
fn from(message: types::VolumeMount) -> Self {
let types::VolumeMount { volume, container_path } = message;
Self {
volume: self::present(volume),
container_path: self::present(container_path),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::VolumeMount> for types::VolumeMount {
fn from(message: wire::VolumeMount) -> Self {
let wire::VolumeMount {
volume,
container_path,
__buffa_unknown_fields: _,
} = message;
Self {
volume: volume.unwrap_or_default(),
container_path: container_path.unwrap_or_default(),
}
}
}
impl From<types::HealthCheck> for wire::HealthCheck {
fn from(message: types::HealthCheck) -> Self {
let types::HealthCheck {
command,
interval_seconds,
status,
consecutive_failure_count,
recent_results_passed,
last_failure_output,
} = message;
Self {
command,
interval_seconds: self::present(interval_seconds),
status: self::present(status).map(health_status_to_wire),
consecutive_failure_count: self::present(consecutive_failure_count),
recent_results_passed,
last_failure_output: self::present(last_failure_output),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::HealthCheck> for types::HealthCheck {
fn from(message: wire::HealthCheck) -> Self {
let wire::HealthCheck {
command,
interval_seconds,
status,
consecutive_failure_count,
recent_results_passed,
last_failure_output,
__buffa_unknown_fields: _,
} = message;
Self {
command,
interval_seconds: interval_seconds.unwrap_or_default(),
status: status.map(health_status_from_wire).unwrap_or_default(),
consecutive_failure_count: consecutive_failure_count.unwrap_or_default(),
recent_results_passed,
last_failure_output: last_failure_output.unwrap_or_default(),
}
}
}
impl From<types::EnvironmentVariable> for wire::EnvironmentVariable {
fn from(message: types::EnvironmentVariable) -> Self {
let types::EnvironmentVariable {
name,
value,
secret,
source_file,
from_env_file_variables,
value_left_out,
} = message;
Self {
name: self::present(name),
value: self::present(value),
secret: self::present(secret),
source_file: self::present(source_file),
from_env_file_variables,
value_left_out: self::present(value_left_out),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::EnvironmentVariable> for types::EnvironmentVariable {
fn from(message: wire::EnvironmentVariable) -> Self {
let wire::EnvironmentVariable {
name,
value,
secret,
source_file,
from_env_file_variables,
value_left_out,
__buffa_unknown_fields: _,
} = message;
Self {
name: name.unwrap_or_default(),
value: value.unwrap_or_default(),
secret: secret.unwrap_or_default(),
source_file: source_file.unwrap_or_default(),
from_env_file_variables,
value_left_out: value_left_out.unwrap_or_default(),
}
}
}
impl From<types::Volume> for wire::Volume {
fn from(message: types::Volume) -> Self {
let types::Volume {
volume,
size_bytes,
mounted_by,
last_backup_time,
snapshot_count,
declared,
} = message;
Self {
volume: self::present(volume),
size_bytes: self::present(size_bytes),
mounted_by: mounted_by.into_iter().map(wire::VolumeMountedBy::from).collect(),
last_backup_time: last_backup_time.map(crate::timestamp::to_wire).into(),
snapshot_count: self::present(snapshot_count),
declared: self::present(declared),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::Volume> for types::Volume {
fn from(message: wire::Volume) -> Self {
let wire::Volume {
volume,
size_bytes,
mounted_by,
last_backup_time,
snapshot_count,
declared,
__buffa_unknown_fields: _,
} = message;
Self {
volume: volume.unwrap_or_default(),
size_bytes: size_bytes.unwrap_or_default(),
mounted_by: mounted_by.into_iter().map(types::VolumeMountedBy::from).collect(),
last_backup_time: last_backup_time.into_option().map(crate::timestamp::from_wire),
snapshot_count: snapshot_count.unwrap_or_default(),
declared: declared.unwrap_or_default(),
}
}
}
impl From<types::VolumeMountedBy> for wire::VolumeMountedBy {
fn from(message: types::VolumeMountedBy) -> Self {
let types::VolumeMountedBy {
service,
container_path,
} = message;
Self {
service: self::present(service),
container_path: self::present(container_path),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::VolumeMountedBy> for types::VolumeMountedBy {
fn from(message: wire::VolumeMountedBy) -> Self {
let wire::VolumeMountedBy {
service,
container_path,
__buffa_unknown_fields: _,
} = message;
Self {
service: service.unwrap_or_default(),
container_path: container_path.unwrap_or_default(),
}
}
}
impl From<types::Host> for wire::Host {
fn from(message: types::Host) -> Self {
let types::Host {
host,
url,
certificate_source,
certificate_expire_time,
unavailable_message,
} = message;
Self {
host: self::present(host),
url: self::present(url),
certificate_source: self::present(certificate_source).map(certificate_source_to_wire),
certificate_expire_time: certificate_expire_time.map(crate::timestamp::to_wire).into(),
unavailable_message: self::present(unavailable_message),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::Host> for types::Host {
fn from(message: wire::Host) -> Self {
let wire::Host {
host,
url,
certificate_source,
certificate_expire_time,
unavailable_message,
__buffa_unknown_fields: _,
} = message;
Self {
host: host.unwrap_or_default(),
url: url.unwrap_or_default(),
certificate_source: certificate_source.map(certificate_source_from_wire).unwrap_or_default(),
certificate_expire_time: certificate_expire_time.into_option().map(crate::timestamp::from_wire),
unavailable_message: unavailable_message.unwrap_or_default(),
}
}
}
impl From<types::Route> for wire::Route {
fn from(message: types::Route) -> Self {
let types::Route {
host,
path,
service,
port,
strip_path,
} = message;
Self {
host: self::present(host),
path: self::present(path),
service: self::present(service),
port: self::present(port),
strip_path: self::present(strip_path),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::Route> for types::Route {
fn from(message: wire::Route) -> Self {
let wire::Route {
host,
path,
service,
port,
strip_path,
__buffa_unknown_fields: _,
} = message;
Self {
host: host.unwrap_or_default(),
path: path.unwrap_or_default(),
service: service.unwrap_or_default(),
port: port.unwrap_or_default(),
strip_path: strip_path.unwrap_or_default(),
}
}
}
impl From<types::Operation> for wire::Operation {
fn from(message: types::Operation) -> Self {
let types::Operation {
operation_id,
kind,
status,
start_time,
finish_time,
failure_message,
deploy_failure_reason,
made_current,
service,
failed_exit_code,
snapshot_id,
restored_volumes,
undo_snapshot_id,
github_commit,
archive_name,
adjustments,
changed_paths,
changed_path_count,
files_kept,
files_operation_id,
} = message;
Self {
operation_id: self::present(operation_id),
kind: self::present(kind).map(operation_kind_to_wire),
status: self::present(status).map(operation_status_to_wire),
start_time: start_time.map(crate::timestamp::to_wire).into(),
finish_time: finish_time.map(crate::timestamp::to_wire).into(),
failure_message: self::present(failure_message),
deploy_failure_reason: self::present(deploy_failure_reason).map(deploy_failure_reason_to_wire),
made_current: self::present(made_current),
service: self::present(service),
failed_exit_code: self::present(failed_exit_code),
snapshot_id: self::present(snapshot_id),
restored_volumes,
undo_snapshot_id: self::present(undo_snapshot_id),
github_commit: github_commit.map(wire::GithubCommit::from).into(),
archive_name: self::present(archive_name),
adjustments,
changed_paths,
changed_path_count: self::present(changed_path_count),
files_kept: self::present(files_kept),
files_operation_id: self::present(files_operation_id),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::Operation> for types::Operation {
fn from(message: wire::Operation) -> Self {
let wire::Operation {
operation_id,
kind,
status,
start_time,
finish_time,
failure_message,
deploy_failure_reason,
made_current,
service,
failed_exit_code,
snapshot_id,
restored_volumes,
undo_snapshot_id,
github_commit,
archive_name,
adjustments,
changed_paths,
changed_path_count,
files_kept,
files_operation_id,
__buffa_unknown_fields: _,
} = message;
Self {
operation_id: operation_id.unwrap_or_default(),
kind: kind.map(operation_kind_from_wire).unwrap_or_default(),
status: status.map(operation_status_from_wire).unwrap_or_default(),
start_time: start_time.into_option().map(crate::timestamp::from_wire),
finish_time: finish_time.into_option().map(crate::timestamp::from_wire),
failure_message: failure_message.unwrap_or_default(),
deploy_failure_reason: deploy_failure_reason
.map(deploy_failure_reason_from_wire)
.unwrap_or_default(),
made_current: made_current.unwrap_or_default(),
service: service.unwrap_or_default(),
failed_exit_code: failed_exit_code.unwrap_or_default(),
snapshot_id: snapshot_id.unwrap_or_default(),
restored_volumes,
undo_snapshot_id: undo_snapshot_id.unwrap_or_default(),
github_commit: github_commit.into_option().map(types::GithubCommit::from),
archive_name: archive_name.unwrap_or_default(),
adjustments,
changed_paths,
changed_path_count: changed_path_count.unwrap_or_default(),
files_kept: files_kept.unwrap_or_default(),
files_operation_id: files_operation_id.unwrap_or_default(),
}
}
}
impl From<types::Snapshot> for wire::Snapshot {
fn from(message: types::Snapshot) -> Self {
let types::Snapshot {
snapshot_id,
create_time,
size_bytes,
volumes,
} = message;
Self {
snapshot_id: self::present(snapshot_id),
create_time: create_time.map(crate::timestamp::to_wire).into(),
size_bytes: self::present(size_bytes),
volumes,
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::Snapshot> for types::Snapshot {
fn from(message: wire::Snapshot) -> Self {
let wire::Snapshot {
snapshot_id,
create_time,
size_bytes,
volumes,
__buffa_unknown_fields: _,
} = message;
Self {
snapshot_id: snapshot_id.unwrap_or_default(),
create_time: create_time.into_option().map(crate::timestamp::from_wire),
size_bytes: size_bytes.unwrap_or_default(),
volumes,
}
}
}
impl From<types::HttpTrafficSummary> for wire::HttpTrafficSummary {
fn from(message: types::HttpTrafficSummary) -> Self {
let types::HttpTrafficSummary {
request_count,
server_error_count,
latency_p50_ms,
latency_p95_ms,
} = message;
Self {
request_count: self::present(request_count),
server_error_count: self::present(server_error_count),
latency_p50_ms: self::present(latency_p50_ms),
latency_p95_ms: self::present(latency_p95_ms),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::HttpTrafficSummary> for types::HttpTrafficSummary {
fn from(message: wire::HttpTrafficSummary) -> Self {
let wire::HttpTrafficSummary {
request_count,
server_error_count,
latency_p50_ms,
latency_p95_ms,
__buffa_unknown_fields: _,
} = message;
Self {
request_count: request_count.unwrap_or_default(),
server_error_count: server_error_count.unwrap_or_default(),
latency_p50_ms: latency_p50_ms.unwrap_or_default(),
latency_p95_ms: latency_p95_ms.unwrap_or_default(),
}
}
}
impl From<types::CreateProjectRequest> for wire::CreateProjectRequest {
fn from(message: types::CreateProjectRequest) -> Self {
let types::CreateProjectRequest {
project_id,
source,
upload_id,
files,
x_pethost,
timeout_seconds,
operation_id,
wait_seconds,
database,
} = message;
Self {
project_id: self::present(project_id),
source: source.map(wire::ProjectSource::from).into(),
upload_id: self::present(upload_id),
files: files.into_iter().map(wire::FileChange::from).collect(),
x_pethost: x_pethost.map(wire::ProjectExtension::from).into(),
timeout_seconds: self::present(timeout_seconds),
operation_id: self::present(operation_id),
wait_seconds,
database: self::present(database).map(database_engine_to_wire),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::CreateProjectRequest> for types::CreateProjectRequest {
fn from(message: wire::CreateProjectRequest) -> Self {
let wire::CreateProjectRequest {
project_id,
source,
upload_id,
files,
x_pethost,
timeout_seconds,
operation_id,
wait_seconds,
database,
__buffa_unknown_fields: _,
} = message;
Self {
project_id: project_id.unwrap_or_default(),
source: source.into_option().map(types::ProjectSource::from),
upload_id: upload_id.unwrap_or_default(),
files: files.into_iter().map(types::FileChange::from).collect(),
x_pethost: x_pethost.into_option().map(types::ProjectExtension::from),
timeout_seconds: timeout_seconds.unwrap_or_default(),
operation_id: operation_id.unwrap_or_default(),
wait_seconds,
database: database.map(database_engine_from_wire).unwrap_or_default(),
}
}
}
impl From<types::CreateProjectResponse> for wire::CreateProjectResponse {
fn from(message: types::CreateProjectResponse) -> Self {
let types::CreateProjectResponse {
operation,
violations,
adjustments,
project,
log,
} = message;
Self {
operation: operation.map(wire::Operation::from).into(),
violations: violations.into_iter().map(wire::SpecViolation::from).collect(),
adjustments,
project: project.map(wire::Project::from).into(),
log: log.into_iter().map(wire::OperationLogLine::from).collect(),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::CreateProjectResponse> for types::CreateProjectResponse {
fn from(message: wire::CreateProjectResponse) -> Self {
let wire::CreateProjectResponse {
operation,
violations,
adjustments,
project,
log,
__buffa_unknown_fields: _,
} = message;
Self {
operation: operation.into_option().map(types::Operation::from),
violations: violations.into_iter().map(types::SpecViolation::from).collect(),
adjustments,
project: project.into_option().map(types::Project::from),
log: log.into_iter().map(types::OperationLogLine::from).collect(),
}
}
}
impl From<types::DeployProjectRequest> for wire::DeployProjectRequest {
fn from(message: types::DeployProjectRequest) -> Self {
let types::DeployProjectRequest {
project_id,
base_deploy_id,
files,
x_pethost,
mount_volume,
timeout_seconds,
operation_id,
version,
wait_seconds,
} = message;
Self {
project_id: self::present(project_id),
base_deploy_id: self::present(base_deploy_id),
files: files.into_iter().map(wire::FileChange::from).collect(),
x_pethost: x_pethost.map(wire::ProjectExtension::from).into(),
mount_volume: mount_volume.map(wire::MountVolume::from).into(),
timeout_seconds: self::present(timeout_seconds),
operation_id: self::present(operation_id),
version: match version {
Some(types::DeployProjectRequestVersion::UploadId(value)) => {
Some(wire::__buffa::oneof::deploy_project_request::Version::UploadId(value))
}
Some(types::DeployProjectRequestVersion::Commit(value)) => {
Some(wire::__buffa::oneof::deploy_project_request::Version::Commit(value))
}
Some(types::DeployProjectRequestVersion::NewestCommit(value)) => Some(
wire::__buffa::oneof::deploy_project_request::Version::NewestCommit(value),
),
Some(types::DeployProjectRequestVersion::RollbackDeployId(value)) => Some(
wire::__buffa::oneof::deploy_project_request::Version::RollbackDeployId(value),
),
None => None,
},
wait_seconds,
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::DeployProjectRequest> for types::DeployProjectRequest {
fn from(message: wire::DeployProjectRequest) -> Self {
let wire::DeployProjectRequest {
project_id,
base_deploy_id,
files,
x_pethost,
mount_volume,
timeout_seconds,
operation_id,
version,
wait_seconds,
__buffa_unknown_fields: _,
} = message;
Self {
project_id: project_id.unwrap_or_default(),
base_deploy_id: base_deploy_id.unwrap_or_default(),
files: files.into_iter().map(types::FileChange::from).collect(),
x_pethost: x_pethost.into_option().map(types::ProjectExtension::from),
mount_volume: mount_volume.into_option().map(types::MountVolume::from),
timeout_seconds: timeout_seconds.unwrap_or_default(),
operation_id: operation_id.unwrap_or_default(),
version: match version {
Some(wire::__buffa::oneof::deploy_project_request::Version::UploadId(value)) => {
Some(types::DeployProjectRequestVersion::UploadId(value))
}
Some(wire::__buffa::oneof::deploy_project_request::Version::Commit(value)) => {
Some(types::DeployProjectRequestVersion::Commit(value))
}
Some(wire::__buffa::oneof::deploy_project_request::Version::NewestCommit(value)) => {
Some(types::DeployProjectRequestVersion::NewestCommit(value))
}
Some(wire::__buffa::oneof::deploy_project_request::Version::RollbackDeployId(value)) => {
Some(types::DeployProjectRequestVersion::RollbackDeployId(value))
}
None => None,
},
wait_seconds,
}
}
}
impl From<types::MountVolume> for wire::MountVolume {
fn from(message: types::MountVolume) -> Self {
let types::MountVolume {
service,
volume,
container_path,
} = message;
Self {
service: self::present(service),
volume: self::present(volume),
container_path: self::present(container_path),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::MountVolume> for types::MountVolume {
fn from(message: wire::MountVolume) -> Self {
let wire::MountVolume {
service,
volume,
container_path,
__buffa_unknown_fields: _,
} = message;
Self {
service: service.unwrap_or_default(),
volume: volume.unwrap_or_default(),
container_path: container_path.unwrap_or_default(),
}
}
}
impl From<types::ProjectExtension> for wire::ProjectExtension {
fn from(message: types::ProjectExtension) -> Self {
let types::ProjectExtension {
metadata,
routes,
remove_routes,
password,
remove_password,
} = message;
Self {
metadata: metadata.map(wire::ProjectMetadata::from).into(),
routes: routes.into_iter().map(wire::Route::from).collect(),
remove_routes: self::present(remove_routes),
password: self::present(password),
remove_password: self::present(remove_password),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::ProjectExtension> for types::ProjectExtension {
fn from(message: wire::ProjectExtension) -> Self {
let wire::ProjectExtension {
metadata,
routes,
remove_routes,
password,
remove_password,
__buffa_unknown_fields: _,
} = message;
Self {
metadata: metadata.into_option().map(types::ProjectMetadata::from),
routes: routes.into_iter().map(types::Route::from).collect(),
remove_routes: remove_routes.unwrap_or_default(),
password: password.unwrap_or_default(),
remove_password: remove_password.unwrap_or_default(),
}
}
}
impl From<types::FileChange> for wire::FileChange {
fn from(message: types::FileChange) -> Self {
let types::FileChange {
path,
change,
executable,
} = message;
Self {
path: self::present(path),
change: match change {
Some(types::FileChangeChange::Text(value)) => {
Some(wire::__buffa::oneof::file_change::Change::Text(value))
}
Some(types::FileChangeChange::Data(value)) => {
Some(wire::__buffa::oneof::file_change::Change::Data(value))
}
Some(types::FileChangeChange::MakeDirectory(value)) => {
Some(wire::__buffa::oneof::file_change::Change::MakeDirectory(value))
}
Some(types::FileChangeChange::Delete(value)) => {
Some(wire::__buffa::oneof::file_change::Change::Delete(value))
}
Some(types::FileChangeChange::DeleteTree(value)) => {
Some(wire::__buffa::oneof::file_change::Change::DeleteTree(value))
}
Some(types::FileChangeChange::RenameTo(value)) => {
Some(wire::__buffa::oneof::file_change::Change::RenameTo(value))
}
None => None,
},
executable: self::present(executable),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::FileChange> for types::FileChange {
fn from(message: wire::FileChange) -> Self {
let wire::FileChange {
path,
change,
executable,
__buffa_unknown_fields: _,
} = message;
Self {
path: path.unwrap_or_default(),
change: match change {
Some(wire::__buffa::oneof::file_change::Change::Text(value)) => {
Some(types::FileChangeChange::Text(value))
}
Some(wire::__buffa::oneof::file_change::Change::Data(value)) => {
Some(types::FileChangeChange::Data(value))
}
Some(wire::__buffa::oneof::file_change::Change::MakeDirectory(value)) => {
Some(types::FileChangeChange::MakeDirectory(value))
}
Some(wire::__buffa::oneof::file_change::Change::Delete(value)) => {
Some(types::FileChangeChange::Delete(value))
}
Some(wire::__buffa::oneof::file_change::Change::DeleteTree(value)) => {
Some(types::FileChangeChange::DeleteTree(value))
}
Some(wire::__buffa::oneof::file_change::Change::RenameTo(value)) => {
Some(types::FileChangeChange::RenameTo(value))
}
None => None,
},
executable: executable.unwrap_or_default(),
}
}
}
impl From<types::DeployProjectResponse> for wire::DeployProjectResponse {
fn from(message: types::DeployProjectResponse) -> Self {
let types::DeployProjectResponse {
operation,
violations,
adjustments,
project,
log,
} = message;
Self {
operation: operation.map(wire::Operation::from).into(),
violations: violations.into_iter().map(wire::SpecViolation::from).collect(),
adjustments,
project: project.map(wire::Project::from).into(),
log: log.into_iter().map(wire::OperationLogLine::from).collect(),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::DeployProjectResponse> for types::DeployProjectResponse {
fn from(message: wire::DeployProjectResponse) -> Self {
let wire::DeployProjectResponse {
operation,
violations,
adjustments,
project,
log,
__buffa_unknown_fields: _,
} = message;
Self {
operation: operation.into_option().map(types::Operation::from),
violations: violations.into_iter().map(types::SpecViolation::from).collect(),
adjustments,
project: project.into_option().map(types::Project::from),
log: log.into_iter().map(types::OperationLogLine::from).collect(),
}
}
}
impl From<types::SpecViolation> for wire::SpecViolation {
fn from(message: types::SpecViolation) -> Self {
let types::SpecViolation {
service,
location,
violation_message,
} = message;
Self {
service: self::present(service),
location: self::present(location),
violation_message: self::present(violation_message),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::SpecViolation> for types::SpecViolation {
fn from(message: wire::SpecViolation) -> Self {
let wire::SpecViolation {
service,
location,
violation_message,
__buffa_unknown_fields: _,
} = message;
Self {
service: service.unwrap_or_default(),
location: location.unwrap_or_default(),
violation_message: violation_message.unwrap_or_default(),
}
}
}
impl From<types::ListCommitsRequest> for wire::ListCommitsRequest {
fn from(message: types::ListCommitsRequest) -> Self {
let types::ListCommitsRequest {
project_id,
before_commit,
} = message;
Self {
project_id: self::present(project_id),
before_commit: self::present(before_commit),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::ListCommitsRequest> for types::ListCommitsRequest {
fn from(message: wire::ListCommitsRequest) -> Self {
let wire::ListCommitsRequest {
project_id,
before_commit,
__buffa_unknown_fields: _,
} = message;
Self {
project_id: project_id.unwrap_or_default(),
before_commit: before_commit.unwrap_or_default(),
}
}
}
impl From<types::ListCommitsResponse> for wire::ListCommitsResponse {
fn from(message: types::ListCommitsResponse) -> Self {
let types::ListCommitsResponse { commits, more } = message;
Self {
commits: commits.into_iter().map(wire::BranchCommit::from).collect(),
more: self::present(more),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::ListCommitsResponse> for types::ListCommitsResponse {
fn from(message: wire::ListCommitsResponse) -> Self {
let wire::ListCommitsResponse {
commits,
more,
__buffa_unknown_fields: _,
} = message;
Self {
commits: commits.into_iter().map(types::BranchCommit::from).collect(),
more: more.unwrap_or_default(),
}
}
}
impl From<types::BranchCommit> for wire::BranchCommit {
fn from(message: types::BranchCommit) -> Self {
let types::BranchCommit {
commit,
author,
commit_time,
deployed,
last_deploy,
newest,
} = message;
Self {
commit: commit.map(wire::GithubCommit::from).into(),
author: self::present(author),
commit_time: commit_time.map(crate::timestamp::to_wire).into(),
deployed: self::present(deployed),
last_deploy: last_deploy.map(wire::Operation::from).into(),
newest: self::present(newest),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::BranchCommit> for types::BranchCommit {
fn from(message: wire::BranchCommit) -> Self {
let wire::BranchCommit {
commit,
author,
commit_time,
deployed,
last_deploy,
newest,
__buffa_unknown_fields: _,
} = message;
Self {
commit: commit.into_option().map(types::GithubCommit::from),
author: author.unwrap_or_default(),
commit_time: commit_time.into_option().map(crate::timestamp::from_wire),
deployed: deployed.unwrap_or_default(),
last_deploy: last_deploy.into_option().map(types::Operation::from),
newest: newest.unwrap_or_default(),
}
}
}
impl From<types::RunProjectActionRequest> for wire::RunProjectActionRequest {
fn from(message: types::RunProjectActionRequest) -> Self {
let types::RunProjectActionRequest {
project_id,
action,
operation_id,
wait_seconds,
} = message;
Self {
project_id: self::present(project_id),
action: match action {
Some(types::RunProjectActionRequestAction::StartServices(value)) => {
Some(wire::__buffa::oneof::run_project_action_request::Action::StartServices(
Box::new(wire::ServicesAction::from(value)),
))
}
Some(types::RunProjectActionRequestAction::StopServices(value)) => {
Some(wire::__buffa::oneof::run_project_action_request::Action::StopServices(
Box::new(wire::ServicesAction::from(value)),
))
}
Some(types::RunProjectActionRequestAction::RestartServices(value)) => Some(
wire::__buffa::oneof::run_project_action_request::Action::RestartServices(Box::new(
wire::ServicesAction::from(value),
)),
),
Some(types::RunProjectActionRequestAction::RecreateService(value)) => Some(
wire::__buffa::oneof::run_project_action_request::Action::RecreateService(Box::new(
wire::RecreateServiceAction::from(value),
)),
),
Some(types::RunProjectActionRequestAction::BackUp(value)) => {
Some(wire::__buffa::oneof::run_project_action_request::Action::BackUp(
Box::new(wire::BackUpAction::from(value)),
))
}
Some(types::RunProjectActionRequestAction::RestoreSnapshot(value)) => Some(
wire::__buffa::oneof::run_project_action_request::Action::RestoreSnapshot(Box::new(
wire::RestoreSnapshotAction::from(value),
)),
),
Some(types::RunProjectActionRequestAction::CancelOperation(value)) => Some(
wire::__buffa::oneof::run_project_action_request::Action::CancelOperation(Box::new(
wire::CancelOperationAction::from(value),
)),
),
Some(types::RunProjectActionRequestAction::DeleteProject(value)) => {
Some(wire::__buffa::oneof::run_project_action_request::Action::DeleteProject(
Box::new(wire::DeleteProjectAction::from(value)),
))
}
Some(types::RunProjectActionRequestAction::SetSource(value)) => {
Some(wire::__buffa::oneof::run_project_action_request::Action::SetSource(
Box::new(wire::ProjectSource::from(value)),
))
}
Some(types::RunProjectActionRequestAction::DeleteVolume(value)) => Some(
wire::__buffa::oneof::run_project_action_request::Action::DeleteVolume(value),
),
None => None,
},
operation_id: self::present(operation_id),
wait_seconds,
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::RunProjectActionRequest> for types::RunProjectActionRequest {
fn from(message: wire::RunProjectActionRequest) -> Self {
let wire::RunProjectActionRequest {
project_id,
action,
operation_id,
wait_seconds,
__buffa_unknown_fields: _,
} = message;
Self {
project_id: project_id.unwrap_or_default(),
action: match action {
Some(wire::__buffa::oneof::run_project_action_request::Action::StartServices(value)) => Some(
types::RunProjectActionRequestAction::StartServices(types::ServicesAction::from(*value)),
),
Some(wire::__buffa::oneof::run_project_action_request::Action::StopServices(value)) => Some(
types::RunProjectActionRequestAction::StopServices(types::ServicesAction::from(*value)),
),
Some(wire::__buffa::oneof::run_project_action_request::Action::RestartServices(value)) => Some(
types::RunProjectActionRequestAction::RestartServices(types::ServicesAction::from(*value)),
),
Some(wire::__buffa::oneof::run_project_action_request::Action::RecreateService(value)) => Some(
types::RunProjectActionRequestAction::RecreateService(types::RecreateServiceAction::from(*value)),
),
Some(wire::__buffa::oneof::run_project_action_request::Action::BackUp(value)) => Some(
types::RunProjectActionRequestAction::BackUp(types::BackUpAction::from(*value)),
),
Some(wire::__buffa::oneof::run_project_action_request::Action::RestoreSnapshot(value)) => Some(
types::RunProjectActionRequestAction::RestoreSnapshot(types::RestoreSnapshotAction::from(*value)),
),
Some(wire::__buffa::oneof::run_project_action_request::Action::CancelOperation(value)) => Some(
types::RunProjectActionRequestAction::CancelOperation(types::CancelOperationAction::from(*value)),
),
Some(wire::__buffa::oneof::run_project_action_request::Action::DeleteProject(value)) => Some(
types::RunProjectActionRequestAction::DeleteProject(types::DeleteProjectAction::from(*value)),
),
Some(wire::__buffa::oneof::run_project_action_request::Action::SetSource(value)) => Some(
types::RunProjectActionRequestAction::SetSource(types::ProjectSource::from(*value)),
),
Some(wire::__buffa::oneof::run_project_action_request::Action::DeleteVolume(value)) => {
Some(types::RunProjectActionRequestAction::DeleteVolume(value))
}
None => None,
},
operation_id: operation_id.unwrap_or_default(),
wait_seconds,
}
}
}
impl From<types::ServicesAction> for wire::ServicesAction {
fn from(message: types::ServicesAction) -> Self {
let types::ServicesAction { services } = message;
Self {
services,
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::ServicesAction> for types::ServicesAction {
fn from(message: wire::ServicesAction) -> Self {
let wire::ServicesAction {
services,
__buffa_unknown_fields: _,
} = message;
Self { services }
}
}
impl From<types::RecreateServiceAction> for wire::RecreateServiceAction {
fn from(message: types::RecreateServiceAction) -> Self {
let types::RecreateServiceAction {
service,
pull_latest_image,
} = message;
Self {
service: self::present(service),
pull_latest_image: self::present(pull_latest_image),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::RecreateServiceAction> for types::RecreateServiceAction {
fn from(message: wire::RecreateServiceAction) -> Self {
let wire::RecreateServiceAction {
service,
pull_latest_image,
__buffa_unknown_fields: _,
} = message;
Self {
service: service.unwrap_or_default(),
pull_latest_image: pull_latest_image.unwrap_or_default(),
}
}
}
impl From<types::BackUpAction> for wire::BackUpAction {
fn from(message: types::BackUpAction) -> Self {
let types::BackUpAction {} = message;
Self {
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::BackUpAction> for types::BackUpAction {
fn from(message: wire::BackUpAction) -> Self {
let wire::BackUpAction {
__buffa_unknown_fields: _,
} = message;
Self {}
}
}
impl From<types::RestoreSnapshotAction> for wire::RestoreSnapshotAction {
fn from(message: types::RestoreSnapshotAction) -> Self {
let types::RestoreSnapshotAction { snapshot_id, volumes } = message;
Self {
snapshot_id: self::present(snapshot_id),
volumes,
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::RestoreSnapshotAction> for types::RestoreSnapshotAction {
fn from(message: wire::RestoreSnapshotAction) -> Self {
let wire::RestoreSnapshotAction {
snapshot_id,
volumes,
__buffa_unknown_fields: _,
} = message;
Self {
snapshot_id: snapshot_id.unwrap_or_default(),
volumes,
}
}
}
impl From<types::CancelOperationAction> for wire::CancelOperationAction {
fn from(message: types::CancelOperationAction) -> Self {
let types::CancelOperationAction { operation_id } = message;
Self {
operation_id: self::present(operation_id),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::CancelOperationAction> for types::CancelOperationAction {
fn from(message: wire::CancelOperationAction) -> Self {
let wire::CancelOperationAction {
operation_id,
__buffa_unknown_fields: _,
} = message;
Self {
operation_id: operation_id.unwrap_or_default(),
}
}
}
impl From<types::DeleteProjectAction> for wire::DeleteProjectAction {
fn from(message: types::DeleteProjectAction) -> Self {
let types::DeleteProjectAction { skip_final_backup } = message;
Self {
skip_final_backup: self::present(skip_final_backup),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::DeleteProjectAction> for types::DeleteProjectAction {
fn from(message: wire::DeleteProjectAction) -> Self {
let wire::DeleteProjectAction {
skip_final_backup,
__buffa_unknown_fields: _,
} = message;
Self {
skip_final_backup: skip_final_backup.unwrap_or_default(),
}
}
}
impl From<types::RunProjectActionResponse> for wire::RunProjectActionResponse {
fn from(message: types::RunProjectActionResponse) -> Self {
let types::RunProjectActionResponse {
operation,
project,
log,
} = message;
Self {
operation: operation.map(wire::Operation::from).into(),
project: project.map(wire::Project::from).into(),
log: log.into_iter().map(wire::OperationLogLine::from).collect(),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::RunProjectActionResponse> for types::RunProjectActionResponse {
fn from(message: wire::RunProjectActionResponse) -> Self {
let wire::RunProjectActionResponse {
operation,
project,
log,
__buffa_unknown_fields: _,
} = message;
Self {
operation: operation.into_option().map(types::Operation::from),
project: project.into_option().map(types::Project::from),
log: log.into_iter().map(types::OperationLogLine::from).collect(),
}
}
}
impl From<types::Database> for wire::Database {
fn from(message: types::Database) -> Self {
let types::Database {
engine,
major_version,
server_version,
memory_limit_bytes,
data_bytes,
connections,
max_connections,
linked_projects,
connection,
service,
volume,
console_command,
} = message;
Self {
engine: self::present(engine).map(database_engine_to_wire),
major_version: self::present(major_version),
server_version: self::present(server_version),
memory_limit_bytes: self::present(memory_limit_bytes),
data_bytes: self::present(data_bytes),
connections: self::present(connections),
max_connections: self::present(max_connections),
linked_projects,
connection: connection.map(wire::DatabaseConnection::from).into(),
service: self::present(service),
volume: self::present(volume),
console_command,
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::Database> for types::Database {
fn from(message: wire::Database) -> Self {
let wire::Database {
engine,
major_version,
server_version,
memory_limit_bytes,
data_bytes,
connections,
max_connections,
linked_projects,
connection,
service,
volume,
console_command,
__buffa_unknown_fields: _,
} = message;
Self {
engine: engine.map(database_engine_from_wire).unwrap_or_default(),
major_version: major_version.unwrap_or_default(),
server_version: server_version.unwrap_or_default(),
memory_limit_bytes: memory_limit_bytes.unwrap_or_default(),
data_bytes: data_bytes.unwrap_or_default(),
connections: connections.unwrap_or_default(),
max_connections: max_connections.unwrap_or_default(),
linked_projects,
connection: connection.into_option().map(types::DatabaseConnection::from),
service: service.unwrap_or_default(),
volume: volume.unwrap_or_default(),
console_command,
}
}
}
impl From<types::DatabaseConnection> for wire::DatabaseConnection {
fn from(message: types::DatabaseConnection) -> Self {
let types::DatabaseConnection {
host,
port,
user,
database,
password,
url,
local_url,
} = message;
Self {
host: self::present(host),
port: self::present(port),
user: self::present(user),
database: self::present(database),
password: self::present(password),
url: self::present(url),
local_url: self::present(local_url),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::DatabaseConnection> for types::DatabaseConnection {
fn from(message: wire::DatabaseConnection) -> Self {
let wire::DatabaseConnection {
host,
port,
user,
database,
password,
url,
local_url,
__buffa_unknown_fields: _,
} = message;
Self {
host: host.unwrap_or_default(),
port: port.unwrap_or_default(),
user: user.unwrap_or_default(),
database: database.unwrap_or_default(),
password: password.unwrap_or_default(),
url: url.unwrap_or_default(),
local_url: local_url.unwrap_or_default(),
}
}
}
impl From<types::DatabaseSummary> for wire::DatabaseSummary {
fn from(message: types::DatabaseSummary) -> Self {
let types::DatabaseSummary {
engine,
major_version,
data_bytes,
connections,
linked_projects,
server_version,
} = message;
Self {
engine: self::present(engine).map(database_engine_to_wire),
major_version: self::present(major_version),
data_bytes: self::present(data_bytes),
connections: self::present(connections),
linked_projects,
server_version: self::present(server_version),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::DatabaseSummary> for types::DatabaseSummary {
fn from(message: wire::DatabaseSummary) -> Self {
let wire::DatabaseSummary {
engine,
major_version,
data_bytes,
connections,
linked_projects,
server_version,
__buffa_unknown_fields: _,
} = message;
Self {
engine: engine.map(database_engine_from_wire).unwrap_or_default(),
major_version: major_version.unwrap_or_default(),
data_bytes: data_bytes.unwrap_or_default(),
connections: connections.unwrap_or_default(),
linked_projects,
server_version: server_version.unwrap_or_default(),
}
}
}
impl From<types::DatabaseEngineOffer> for wire::DatabaseEngineOffer {
fn from(message: types::DatabaseEngineOffer) -> Self {
let types::DatabaseEngineOffer {
engine,
major_version,
sizes,
default_memory_limit_bytes,
} = message;
Self {
engine: self::present(engine).map(database_engine_to_wire),
major_version: self::present(major_version),
sizes: sizes.into_iter().map(wire::DatabaseSizeChoice::from).collect(),
default_memory_limit_bytes: self::present(default_memory_limit_bytes),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::DatabaseEngineOffer> for types::DatabaseEngineOffer {
fn from(message: wire::DatabaseEngineOffer) -> Self {
let wire::DatabaseEngineOffer {
engine,
major_version,
sizes,
default_memory_limit_bytes,
__buffa_unknown_fields: _,
} = message;
Self {
engine: engine.map(database_engine_from_wire).unwrap_or_default(),
major_version: major_version.unwrap_or_default(),
sizes: sizes.into_iter().map(types::DatabaseSizeChoice::from).collect(),
default_memory_limit_bytes: default_memory_limit_bytes.unwrap_or_default(),
}
}
}
impl From<types::DatabaseSizeChoice> for wire::DatabaseSizeChoice {
fn from(message: types::DatabaseSizeChoice) -> Self {
let types::DatabaseSizeChoice { memory_limit_bytes } = message;
Self {
memory_limit_bytes: self::present(memory_limit_bytes),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::DatabaseSizeChoice> for types::DatabaseSizeChoice {
fn from(message: wire::DatabaseSizeChoice) -> Self {
let wire::DatabaseSizeChoice {
memory_limit_bytes,
__buffa_unknown_fields: _,
} = message;
Self {
memory_limit_bytes: memory_limit_bytes.unwrap_or_default(),
}
}
}
impl From<types::LinkDatabaseRequest> for wire::LinkDatabaseRequest {
fn from(message: types::LinkDatabaseRequest) -> Self {
let types::LinkDatabaseRequest {
database_project_id,
link,
unlink,
} = message;
Self {
database_project_id: self::present(database_project_id),
link,
unlink,
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::LinkDatabaseRequest> for types::LinkDatabaseRequest {
fn from(message: wire::LinkDatabaseRequest) -> Self {
let wire::LinkDatabaseRequest {
database_project_id,
link,
unlink,
__buffa_unknown_fields: _,
} = message;
Self {
database_project_id: database_project_id.unwrap_or_default(),
link,
unlink,
}
}
}
impl From<types::LinkDatabaseResponse> for wire::LinkDatabaseResponse {
fn from(message: types::LinkDatabaseResponse) -> Self {
let types::LinkDatabaseResponse { project } = message;
Self {
project: project.map(wire::Project::from).into(),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::LinkDatabaseResponse> for types::LinkDatabaseResponse {
fn from(message: wire::LinkDatabaseResponse) -> Self {
let wire::LinkDatabaseResponse {
project,
__buffa_unknown_fields: _,
} = message;
Self {
project: project.into_option().map(types::Project::from),
}
}
}
impl From<types::SetProjectAlertsRequest> for wire::SetProjectAlertsRequest {
fn from(message: types::SetProjectAlertsRequest) -> Self {
let types::SetProjectAlertsRequest {
project_id,
checks,
remove_checks,
traffic_rules,
remove_traffic_rules,
off,
mute_minutes,
} = message;
Self {
project_id: self::present(project_id),
checks: checks.into_iter().map(wire::SiteCheck::from).collect(),
remove_checks: self::present(remove_checks),
traffic_rules: traffic_rules.into_iter().map(wire::TrafficRule::from).collect(),
remove_traffic_rules: self::present(remove_traffic_rules),
off,
mute_minutes,
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::SetProjectAlertsRequest> for types::SetProjectAlertsRequest {
fn from(message: wire::SetProjectAlertsRequest) -> Self {
let wire::SetProjectAlertsRequest {
project_id,
checks,
remove_checks,
traffic_rules,
remove_traffic_rules,
off,
mute_minutes,
__buffa_unknown_fields: _,
} = message;
Self {
project_id: project_id.unwrap_or_default(),
checks: checks.into_iter().map(types::SiteCheck::from).collect(),
remove_checks: remove_checks.unwrap_or_default(),
traffic_rules: traffic_rules.into_iter().map(types::TrafficRule::from).collect(),
remove_traffic_rules: remove_traffic_rules.unwrap_or_default(),
off,
mute_minutes,
}
}
}
impl From<types::SetProjectAlertsResponse> for wire::SetProjectAlertsResponse {
fn from(message: types::SetProjectAlertsResponse) -> Self {
let types::SetProjectAlertsResponse { alerts } = message;
Self {
alerts: alerts.map(wire::ProjectAlerts::from).into(),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::SetProjectAlertsResponse> for types::SetProjectAlertsResponse {
fn from(message: wire::SetProjectAlertsResponse) -> Self {
let wire::SetProjectAlertsResponse {
alerts,
__buffa_unknown_fields: _,
} = message;
Self {
alerts: alerts.into_option().map(types::ProjectAlerts::from),
}
}
}
impl From<types::SiteCheck> for wire::SiteCheck {
fn from(message: types::SiteCheck) -> Self {
let types::SiteCheck {
host,
path,
expect_status,
must_contain,
} = message;
Self {
host: self::present(host),
path: self::present(path),
expect_status: self::present(expect_status),
must_contain: self::present(must_contain),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::SiteCheck> for types::SiteCheck {
fn from(message: wire::SiteCheck) -> Self {
let wire::SiteCheck {
host,
path,
expect_status,
must_contain,
__buffa_unknown_fields: _,
} = message;
Self {
host: host.unwrap_or_default(),
path: path.unwrap_or_default(),
expect_status: expect_status.unwrap_or_default(),
must_contain: must_contain.unwrap_or_default(),
}
}
}
impl From<types::TrafficRule> for wire::TrafficRule {
fn from(message: types::TrafficRule) -> Self {
let types::TrafficRule {
metric,
filter,
threshold,
window_minutes,
min_requests,
} = message;
Self {
metric: self::present(metric).map(traffic_metric_to_wire),
filter: filter.map(wire::HttpTrafficFilter::from).into(),
threshold: self::present(threshold),
window_minutes: self::present(window_minutes),
min_requests: self::present(min_requests),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::TrafficRule> for types::TrafficRule {
fn from(message: wire::TrafficRule) -> Self {
let wire::TrafficRule {
metric,
filter,
threshold,
window_minutes,
min_requests,
__buffa_unknown_fields: _,
} = message;
Self {
metric: metric.map(traffic_metric_from_wire).unwrap_or_default(),
filter: filter.into_option().map(types::HttpTrafficFilter::from),
threshold: threshold.unwrap_or_default(),
window_minutes: window_minutes.unwrap_or_default(),
min_requests: min_requests.unwrap_or_default(),
}
}
}
impl From<types::ProjectAlerts> for wire::ProjectAlerts {
fn from(message: types::ProjectAlerts) -> Self {
let types::ProjectAlerts {
checks,
traffic_rules,
off,
mute_end_time,
uptime_percent,
} = message;
Self {
checks: checks.into_iter().map(wire::SiteCheckState::from).collect(),
traffic_rules: traffic_rules.into_iter().map(wire::TrafficRuleState::from).collect(),
off: self::present(off),
mute_end_time: mute_end_time.map(crate::timestamp::to_wire).into(),
uptime_percent,
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::ProjectAlerts> for types::ProjectAlerts {
fn from(message: wire::ProjectAlerts) -> Self {
let wire::ProjectAlerts {
checks,
traffic_rules,
off,
mute_end_time,
uptime_percent,
__buffa_unknown_fields: _,
} = message;
Self {
checks: checks.into_iter().map(types::SiteCheckState::from).collect(),
traffic_rules: traffic_rules.into_iter().map(types::TrafficRuleState::from).collect(),
off: off.unwrap_or_default(),
mute_end_time: mute_end_time.into_option().map(crate::timestamp::from_wire),
uptime_percent,
}
}
}
impl From<types::SiteCheckState> for wire::SiteCheckState {
fn from(message: types::SiteCheckState) -> Self {
let types::SiteCheckState {
check,
machine_default,
status,
last_result,
incident_id,
} = message;
Self {
check: check.map(wire::SiteCheck::from).into(),
machine_default: self::present(machine_default),
status: self::present(status).map(alert_status_to_wire),
last_result: last_result.map(wire::SiteCheckResult::from).into(),
incident_id: self::present(incident_id),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::SiteCheckState> for types::SiteCheckState {
fn from(message: wire::SiteCheckState) -> Self {
let wire::SiteCheckState {
check,
machine_default,
status,
last_result,
incident_id,
__buffa_unknown_fields: _,
} = message;
Self {
check: check.into_option().map(types::SiteCheck::from),
machine_default: machine_default.unwrap_or_default(),
status: status.map(alert_status_from_wire).unwrap_or_default(),
last_result: last_result.into_option().map(types::SiteCheckResult::from),
incident_id: incident_id.unwrap_or_default(),
}
}
}
impl From<types::SiteCheckResult> for wire::SiteCheckResult {
fn from(message: types::SiteCheckResult) -> Self {
let types::SiteCheckResult {
check_time,
status,
duration_ms,
failure_message,
} = message;
Self {
check_time: check_time.map(crate::timestamp::to_wire).into(),
status: self::present(status),
duration_ms: self::present(duration_ms),
failure_message: self::present(failure_message),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::SiteCheckResult> for types::SiteCheckResult {
fn from(message: wire::SiteCheckResult) -> Self {
let wire::SiteCheckResult {
check_time,
status,
duration_ms,
failure_message,
__buffa_unknown_fields: _,
} = message;
Self {
check_time: check_time.into_option().map(crate::timestamp::from_wire),
status: status.unwrap_or_default(),
duration_ms: duration_ms.unwrap_or_default(),
failure_message: failure_message.unwrap_or_default(),
}
}
}
impl From<types::TrafficRuleState> for wire::TrafficRuleState {
fn from(message: types::TrafficRuleState) -> Self {
let types::TrafficRuleState {
rule,
machine_default,
status,
value,
request_count,
incident_id,
} = message;
Self {
rule: rule.map(wire::TrafficRule::from).into(),
machine_default: self::present(machine_default),
status: self::present(status).map(alert_status_to_wire),
value: self::present(value),
request_count: self::present(request_count),
incident_id: self::present(incident_id),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::TrafficRuleState> for types::TrafficRuleState {
fn from(message: wire::TrafficRuleState) -> Self {
let wire::TrafficRuleState {
rule,
machine_default,
status,
value,
request_count,
incident_id,
__buffa_unknown_fields: _,
} = message;
Self {
rule: rule.into_option().map(types::TrafficRule::from),
machine_default: machine_default.unwrap_or_default(),
status: status.map(alert_status_from_wire).unwrap_or_default(),
value: value.unwrap_or_default(),
request_count: request_count.unwrap_or_default(),
incident_id: incident_id.unwrap_or_default(),
}
}
}
impl From<types::Incident> for wire::Incident {
fn from(message: types::Incident) -> Self {
let types::Incident {
incident_id,
kind,
service,
check,
traffic_rule,
operation_id,
open_time,
resolve_time,
value,
request_count,
after_operation_id,
after_operation_end_time,
joined_incident_id,
quiet_reason,
flapping,
incident_message,
evidence,
} = message;
Self {
incident_id: self::present(incident_id),
kind: self::present(kind).map(project_problem_kind_to_wire),
service: self::present(service),
check: check.map(wire::SiteCheck::from).into(),
traffic_rule: traffic_rule.map(wire::TrafficRule::from).into(),
operation_id: self::present(operation_id),
open_time: open_time.map(crate::timestamp::to_wire).into(),
resolve_time: resolve_time.map(crate::timestamp::to_wire).into(),
value: self::present(value),
request_count: self::present(request_count),
after_operation_id: self::present(after_operation_id),
after_operation_end_time: after_operation_end_time.map(crate::timestamp::to_wire).into(),
joined_incident_id: self::present(joined_incident_id),
quiet_reason: self::present(quiet_reason).map(incident_quiet_reason_to_wire),
flapping: self::present(flapping),
incident_message: self::present(incident_message),
evidence: evidence.map(wire::IncidentEvidence::from).into(),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::Incident> for types::Incident {
fn from(message: wire::Incident) -> Self {
let wire::Incident {
incident_id,
kind,
service,
check,
traffic_rule,
operation_id,
open_time,
resolve_time,
value,
request_count,
after_operation_id,
after_operation_end_time,
joined_incident_id,
quiet_reason,
flapping,
incident_message,
evidence,
__buffa_unknown_fields: _,
} = message;
Self {
incident_id: incident_id.unwrap_or_default(),
kind: kind.map(project_problem_kind_from_wire).unwrap_or_default(),
service: service.unwrap_or_default(),
check: check.into_option().map(types::SiteCheck::from),
traffic_rule: traffic_rule.into_option().map(types::TrafficRule::from),
operation_id: operation_id.unwrap_or_default(),
open_time: open_time.into_option().map(crate::timestamp::from_wire),
resolve_time: resolve_time.into_option().map(crate::timestamp::from_wire),
value: value.unwrap_or_default(),
request_count: request_count.unwrap_or_default(),
after_operation_id: after_operation_id.unwrap_or_default(),
after_operation_end_time: after_operation_end_time.into_option().map(crate::timestamp::from_wire),
joined_incident_id: joined_incident_id.unwrap_or_default(),
quiet_reason: quiet_reason.map(incident_quiet_reason_from_wire).unwrap_or_default(),
flapping: flapping.unwrap_or_default(),
incident_message: incident_message.unwrap_or_default(),
evidence: evidence.into_option().map(types::IncidentEvidence::from),
}
}
}
impl From<types::IncidentEvidence> for wire::IncidentEvidence {
fn from(message: types::IncidentEvidence) -> Self {
let types::IncidentEvidence {
check_result,
exit_code,
oom_killed,
restart_count,
health_output,
log_lines,
top_path,
} = message;
Self {
check_result: check_result.map(wire::SiteCheckResult::from).into(),
exit_code: self::present(exit_code),
oom_killed: self::present(oom_killed),
restart_count: self::present(restart_count),
health_output: self::present(health_output),
log_lines: log_lines.into_iter().map(wire::LogLine::from).collect(),
top_path: top_path.map(wire::HttpPathTraffic::from).into(),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::IncidentEvidence> for types::IncidentEvidence {
fn from(message: wire::IncidentEvidence) -> Self {
let wire::IncidentEvidence {
check_result,
exit_code,
oom_killed,
restart_count,
health_output,
log_lines,
top_path,
__buffa_unknown_fields: _,
} = message;
Self {
check_result: check_result.into_option().map(types::SiteCheckResult::from),
exit_code: exit_code.unwrap_or_default(),
oom_killed: oom_killed.unwrap_or_default(),
restart_count: restart_count.unwrap_or_default(),
health_output: health_output.unwrap_or_default(),
log_lines: log_lines.into_iter().map(types::LogLine::from).collect(),
top_path: top_path.into_option().map(types::HttpPathTraffic::from),
}
}
}
impl From<types::UptimeDay> for wire::UptimeDay {
fn from(message: types::UptimeDay) -> Self {
let types::UptimeDay {
start_time,
uptime_percent,
down_seconds,
} = message;
Self {
start_time: start_time.map(crate::timestamp::to_wire).into(),
uptime_percent,
down_seconds: self::present(down_seconds),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::UptimeDay> for types::UptimeDay {
fn from(message: wire::UptimeDay) -> Self {
let wire::UptimeDay {
start_time,
uptime_percent,
down_seconds,
__buffa_unknown_fields: _,
} = message;
Self {
start_time: start_time.into_option().map(crate::timestamp::from_wire),
uptime_percent,
down_seconds: down_seconds.unwrap_or_default(),
}
}
}
impl From<types::GetOperationRequest> for wire::GetOperationRequest {
fn from(message: types::GetOperationRequest) -> Self {
let types::GetOperationRequest {
project_id,
operation_id,
wait_seconds,
after_log_line,
log_line_limit,
} = message;
Self {
project_id: self::present(project_id),
operation_id: self::present(operation_id),
wait_seconds,
after_log_line,
log_line_limit,
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::GetOperationRequest> for types::GetOperationRequest {
fn from(message: wire::GetOperationRequest) -> Self {
let wire::GetOperationRequest {
project_id,
operation_id,
wait_seconds,
after_log_line,
log_line_limit,
__buffa_unknown_fields: _,
} = message;
Self {
project_id: project_id.unwrap_or_default(),
operation_id: operation_id.unwrap_or_default(),
wait_seconds,
after_log_line,
log_line_limit,
}
}
}
impl From<types::GetOperationResponse> for wire::GetOperationResponse {
fn from(message: types::GetOperationResponse) -> Self {
let types::GetOperationResponse {
operation,
project,
log,
log_line_count,
next_after_log_line,
} = message;
Self {
operation: operation.map(wire::Operation::from).into(),
project: project.map(wire::Project::from).into(),
log: log.into_iter().map(wire::OperationLogLine::from).collect(),
log_line_count: self::present(log_line_count),
next_after_log_line: self::present(next_after_log_line),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::GetOperationResponse> for types::GetOperationResponse {
fn from(message: wire::GetOperationResponse) -> Self {
let wire::GetOperationResponse {
operation,
project,
log,
log_line_count,
next_after_log_line,
__buffa_unknown_fields: _,
} = message;
Self {
operation: operation.into_option().map(types::Operation::from),
project: project.into_option().map(types::Project::from),
log: log.into_iter().map(types::OperationLogLine::from).collect(),
log_line_count: log_line_count.unwrap_or_default(),
next_after_log_line: next_after_log_line.unwrap_or_default(),
}
}
}
impl From<types::OperationLogLine> for wire::OperationLogLine {
fn from(message: types::OperationLogLine) -> Self {
let types::OperationLogLine { time, text } = message;
Self {
time: time.map(crate::timestamp::to_wire).into(),
text: self::present(text),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::OperationLogLine> for types::OperationLogLine {
fn from(message: wire::OperationLogLine) -> Self {
let wire::OperationLogLine {
time,
text,
__buffa_unknown_fields: _,
} = message;
Self {
time: time.into_option().map(crate::timestamp::from_wire),
text: text.unwrap_or_default(),
}
}
}
impl From<types::HttpTrafficFilter> for wire::HttpTrafficFilter {
fn from(message: types::HttpTrafficFilter) -> Self {
let types::HttpTrafficFilter {
host,
method,
path_contains,
path_pattern,
status_class,
} = message;
Self {
host: self::present(host),
method: self::present(method),
path_contains: self::present(path_contains),
path_pattern: self::present(path_pattern),
status_class: self::present(status_class),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::HttpTrafficFilter> for types::HttpTrafficFilter {
fn from(message: wire::HttpTrafficFilter) -> Self {
let wire::HttpTrafficFilter {
host,
method,
path_contains,
path_pattern,
status_class,
__buffa_unknown_fields: _,
} = message;
Self {
host: host.unwrap_or_default(),
method: method.unwrap_or_default(),
path_contains: path_contains.unwrap_or_default(),
path_pattern: path_pattern.unwrap_or_default(),
status_class: status_class.unwrap_or_default(),
}
}
}
impl From<types::QueryHttpTrafficRequest> for wire::QueryHttpTrafficRequest {
fn from(message: types::QueryHttpTrafficRequest) -> Self {
let types::QueryHttpTrafficRequest {
project_id,
filter,
start_time,
end_time,
last_seconds,
bucket_width_seconds,
request_limit,
page_token,
} = message;
Self {
project_id: self::present(project_id),
filter: filter.map(wire::HttpTrafficFilter::from).into(),
start_time: start_time.map(crate::timestamp::to_wire).into(),
end_time: end_time.map(crate::timestamp::to_wire).into(),
last_seconds: self::present(last_seconds),
bucket_width_seconds: self::present(bucket_width_seconds),
request_limit: self::present(request_limit),
page_token: self::present(page_token),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::QueryHttpTrafficRequest> for types::QueryHttpTrafficRequest {
fn from(message: wire::QueryHttpTrafficRequest) -> Self {
let wire::QueryHttpTrafficRequest {
project_id,
filter,
start_time,
end_time,
last_seconds,
bucket_width_seconds,
request_limit,
page_token,
__buffa_unknown_fields: _,
} = message;
Self {
project_id: project_id.unwrap_or_default(),
filter: filter.into_option().map(types::HttpTrafficFilter::from),
start_time: start_time.into_option().map(crate::timestamp::from_wire),
end_time: end_time.into_option().map(crate::timestamp::from_wire),
last_seconds: last_seconds.unwrap_or_default(),
bucket_width_seconds: bucket_width_seconds.unwrap_or_default(),
request_limit: request_limit.unwrap_or_default(),
page_token: page_token.unwrap_or_default(),
}
}
}
impl From<types::QueryHttpTrafficResponse> for wire::QueryHttpTrafficResponse {
fn from(message: types::QueryHttpTrafficResponse) -> Self {
let types::QueryHttpTrafficResponse {
start_time,
end_time,
oldest_kept_time,
summary,
buckets,
top_paths,
newest_sequence,
requests,
next_page_token,
tail_sequence,
} = message;
Self {
start_time: start_time.map(crate::timestamp::to_wire).into(),
end_time: end_time.map(crate::timestamp::to_wire).into(),
oldest_kept_time: oldest_kept_time.map(crate::timestamp::to_wire).into(),
summary: summary.map(wire::HttpTrafficSummary::from).into(),
buckets: buckets.into_iter().map(wire::HttpTrafficBucket::from).collect(),
top_paths: top_paths.into_iter().map(wire::HttpPathTraffic::from).collect(),
newest_sequence: self::present(newest_sequence),
requests: requests.into_iter().map(wire::HttpRequest::from).collect(),
next_page_token: self::present(next_page_token),
tail_sequence: self::present(tail_sequence),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::QueryHttpTrafficResponse> for types::QueryHttpTrafficResponse {
fn from(message: wire::QueryHttpTrafficResponse) -> Self {
let wire::QueryHttpTrafficResponse {
start_time,
end_time,
oldest_kept_time,
summary,
buckets,
top_paths,
newest_sequence,
requests,
next_page_token,
tail_sequence,
__buffa_unknown_fields: _,
} = message;
Self {
start_time: start_time.into_option().map(crate::timestamp::from_wire),
end_time: end_time.into_option().map(crate::timestamp::from_wire),
oldest_kept_time: oldest_kept_time.into_option().map(crate::timestamp::from_wire),
summary: summary.into_option().map(types::HttpTrafficSummary::from),
buckets: buckets.into_iter().map(types::HttpTrafficBucket::from).collect(),
top_paths: top_paths.into_iter().map(types::HttpPathTraffic::from).collect(),
newest_sequence: newest_sequence.unwrap_or_default(),
requests: requests.into_iter().map(types::HttpRequest::from).collect(),
next_page_token: next_page_token.unwrap_or_default(),
tail_sequence: tail_sequence.unwrap_or_default(),
}
}
}
impl From<types::HttpTrafficBucket> for wire::HttpTrafficBucket {
fn from(message: types::HttpTrafficBucket) -> Self {
let types::HttpTrafficBucket { start_time, summary } = message;
Self {
start_time: start_time.map(crate::timestamp::to_wire).into(),
summary: summary.map(wire::HttpTrafficSummary::from).into(),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::HttpTrafficBucket> for types::HttpTrafficBucket {
fn from(message: wire::HttpTrafficBucket) -> Self {
let wire::HttpTrafficBucket {
start_time,
summary,
__buffa_unknown_fields: _,
} = message;
Self {
start_time: start_time.into_option().map(crate::timestamp::from_wire),
summary: summary.into_option().map(types::HttpTrafficSummary::from),
}
}
}
impl From<types::HttpPathTraffic> for wire::HttpPathTraffic {
fn from(message: types::HttpPathTraffic) -> Self {
let types::HttpPathTraffic {
method,
path_pattern,
summary,
} = message;
Self {
method: self::present(method),
path_pattern: self::present(path_pattern),
summary: summary.map(wire::HttpTrafficSummary::from).into(),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::HttpPathTraffic> for types::HttpPathTraffic {
fn from(message: wire::HttpPathTraffic) -> Self {
let wire::HttpPathTraffic {
method,
path_pattern,
summary,
__buffa_unknown_fields: _,
} = message;
Self {
method: method.unwrap_or_default(),
path_pattern: path_pattern.unwrap_or_default(),
summary: summary.into_option().map(types::HttpTrafficSummary::from),
}
}
}
impl From<types::HttpRequest> for wire::HttpRequest {
fn from(message: types::HttpRequest) -> Self {
let types::HttpRequest {
sequence,
finish_time,
host,
method,
path,
path_pattern,
route_path,
service,
port,
status_code,
response_size_bytes,
duration_ms,
service_duration_ms,
client_ip_address,
user_agent,
} = message;
Self {
sequence: self::present(sequence),
finish_time: finish_time.map(crate::timestamp::to_wire).into(),
host: self::present(host),
method: self::present(method),
path: self::present(path),
path_pattern: self::present(path_pattern),
route_path: self::present(route_path),
service: self::present(service),
port: self::present(port),
status_code: self::present(status_code),
response_size_bytes: self::present(response_size_bytes),
duration_ms: self::present(duration_ms),
service_duration_ms: self::present(service_duration_ms),
client_ip_address: self::present(client_ip_address),
user_agent: self::present(user_agent),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::HttpRequest> for types::HttpRequest {
fn from(message: wire::HttpRequest) -> Self {
let wire::HttpRequest {
sequence,
finish_time,
host,
method,
path,
path_pattern,
route_path,
service,
port,
status_code,
response_size_bytes,
duration_ms,
service_duration_ms,
client_ip_address,
user_agent,
__buffa_unknown_fields: _,
} = message;
Self {
sequence: sequence.unwrap_or_default(),
finish_time: finish_time.into_option().map(crate::timestamp::from_wire),
host: host.unwrap_or_default(),
method: method.unwrap_or_default(),
path: path.unwrap_or_default(),
path_pattern: path_pattern.unwrap_or_default(),
route_path: route_path.unwrap_or_default(),
service: service.unwrap_or_default(),
port: port.unwrap_or_default(),
status_code: status_code.unwrap_or_default(),
response_size_bytes: response_size_bytes.unwrap_or_default(),
duration_ms: duration_ms.unwrap_or_default(),
service_duration_ms: service_duration_ms.unwrap_or_default(),
client_ip_address: client_ip_address.unwrap_or_default(),
user_agent: user_agent.unwrap_or_default(),
}
}
}
impl From<types::ContainerLogFilter> for wire::ContainerLogFilter {
fn from(message: types::ContainerLogFilter) -> Self {
let types::ContainerLogFilter {
service,
stream,
text_contains,
} = message;
Self {
service: self::present(service),
stream: self::present(stream).map(output_stream_to_wire),
text_contains: self::present(text_contains),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::ContainerLogFilter> for types::ContainerLogFilter {
fn from(message: wire::ContainerLogFilter) -> Self {
let wire::ContainerLogFilter {
service,
stream,
text_contains,
__buffa_unknown_fields: _,
} = message;
Self {
service: service.unwrap_or_default(),
stream: stream.map(output_stream_from_wire).unwrap_or_default(),
text_contains: text_contains.unwrap_or_default(),
}
}
}
impl From<types::QueryContainerLogsRequest> for wire::QueryContainerLogsRequest {
fn from(message: types::QueryContainerLogsRequest) -> Self {
let types::QueryContainerLogsRequest {
project_id,
filter,
start_time,
end_time,
last_seconds,
limit,
from_start,
page_token,
} = message;
Self {
project_id: self::present(project_id),
filter: filter.map(wire::ContainerLogFilter::from).into(),
start_time: start_time.map(crate::timestamp::to_wire).into(),
end_time: end_time.map(crate::timestamp::to_wire).into(),
last_seconds: self::present(last_seconds),
limit: self::present(limit),
from_start: self::present(from_start),
page_token: self::present(page_token),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::QueryContainerLogsRequest> for types::QueryContainerLogsRequest {
fn from(message: wire::QueryContainerLogsRequest) -> Self {
let wire::QueryContainerLogsRequest {
project_id,
filter,
start_time,
end_time,
last_seconds,
limit,
from_start,
page_token,
__buffa_unknown_fields: _,
} = message;
Self {
project_id: project_id.unwrap_or_default(),
filter: filter.into_option().map(types::ContainerLogFilter::from),
start_time: start_time.into_option().map(crate::timestamp::from_wire),
end_time: end_time.into_option().map(crate::timestamp::from_wire),
last_seconds: last_seconds.unwrap_or_default(),
limit: limit.unwrap_or_default(),
from_start: from_start.unwrap_or_default(),
page_token: page_token.unwrap_or_default(),
}
}
}
impl From<types::QueryContainerLogsResponse> for wire::QueryContainerLogsResponse {
fn from(message: types::QueryContainerLogsResponse) -> Self {
let types::QueryContainerLogsResponse {
start_time,
end_time,
oldest_kept_time,
lines,
next_page_token,
tail_cursor,
} = message;
Self {
start_time: start_time.map(crate::timestamp::to_wire).into(),
end_time: end_time.map(crate::timestamp::to_wire).into(),
oldest_kept_time: oldest_kept_time.map(crate::timestamp::to_wire).into(),
lines: lines.into_iter().map(wire::LogLine::from).collect(),
next_page_token: self::present(next_page_token),
tail_cursor: self::present(tail_cursor),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::QueryContainerLogsResponse> for types::QueryContainerLogsResponse {
fn from(message: wire::QueryContainerLogsResponse) -> Self {
let wire::QueryContainerLogsResponse {
start_time,
end_time,
oldest_kept_time,
lines,
next_page_token,
tail_cursor,
__buffa_unknown_fields: _,
} = message;
Self {
start_time: start_time.into_option().map(crate::timestamp::from_wire),
end_time: end_time.into_option().map(crate::timestamp::from_wire),
oldest_kept_time: oldest_kept_time.into_option().map(crate::timestamp::from_wire),
lines: lines.into_iter().map(types::LogLine::from).collect(),
next_page_token: next_page_token.unwrap_or_default(),
tail_cursor: tail_cursor.unwrap_or_default(),
}
}
}
impl From<types::LogLine> for wire::LogLine {
fn from(message: types::LogLine) -> Self {
let types::LogLine {
time,
service,
stream,
text,
} = message;
Self {
time: time.map(crate::timestamp::to_wire).into(),
service: self::present(service),
stream: self::present(stream).map(output_stream_to_wire),
text: self::present(text),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::LogLine> for types::LogLine {
fn from(message: wire::LogLine) -> Self {
let wire::LogLine {
time,
service,
stream,
text,
__buffa_unknown_fields: _,
} = message;
Self {
time: time.into_option().map(crate::timestamp::from_wire),
service: service.unwrap_or_default(),
stream: stream.map(output_stream_from_wire).unwrap_or_default(),
text: text.unwrap_or_default(),
}
}
}
impl From<types::RunServiceCommandRequest> for wire::RunServiceCommandRequest {
fn from(message: types::RunServiceCommandRequest) -> Self {
let types::RunServiceCommandRequest {
project_id,
service,
command,
stdin,
run_as_user,
working_directory,
timeout_seconds,
} = message;
Self {
project_id: self::present(project_id),
service: self::present(service),
command,
stdin: self::present(stdin),
run_as_user: self::present(run_as_user),
working_directory: self::present(working_directory),
timeout_seconds: self::present(timeout_seconds),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::RunServiceCommandRequest> for types::RunServiceCommandRequest {
fn from(message: wire::RunServiceCommandRequest) -> Self {
let wire::RunServiceCommandRequest {
project_id,
service,
command,
stdin,
run_as_user,
working_directory,
timeout_seconds,
__buffa_unknown_fields: _,
} = message;
Self {
project_id: project_id.unwrap_or_default(),
service: service.unwrap_or_default(),
command,
stdin: stdin.unwrap_or_default(),
run_as_user: run_as_user.unwrap_or_default(),
working_directory: working_directory.unwrap_or_default(),
timeout_seconds: timeout_seconds.unwrap_or_default(),
}
}
}
impl From<types::RunServiceCommandResponse> for wire::RunServiceCommandResponse {
fn from(message: types::RunServiceCommandResponse) -> Self {
let types::RunServiceCommandResponse {
exit_code,
timed_out,
stdout,
stderr,
output_truncated,
} = message;
Self {
exit_code: self::present(exit_code),
timed_out: self::present(timed_out),
stdout: self::present(stdout),
stderr: self::present(stderr),
output_truncated: self::present(output_truncated),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::RunServiceCommandResponse> for types::RunServiceCommandResponse {
fn from(message: wire::RunServiceCommandResponse) -> Self {
let wire::RunServiceCommandResponse {
exit_code,
timed_out,
stdout,
stderr,
output_truncated,
__buffa_unknown_fields: _,
} = message;
Self {
exit_code: exit_code.unwrap_or_default(),
timed_out: timed_out.unwrap_or_default(),
stdout: stdout.unwrap_or_default(),
stderr: stderr.unwrap_or_default(),
output_truncated: output_truncated.unwrap_or_default(),
}
}
}
impl From<types::FileEntry> for wire::FileEntry {
fn from(message: types::FileEntry) -> Self {
let types::FileEntry {
name,
r#type,
size_bytes,
modify_time,
mode,
owner_uid,
owner_gid,
symlink_target,
} = message;
Self {
name: self::present(name),
r#type: self::present(r#type).map(file_type_to_wire),
size_bytes: self::present(size_bytes),
modify_time: modify_time.map(crate::timestamp::to_wire).into(),
mode: self::present(mode),
owner_uid: self::present(owner_uid),
owner_gid: self::present(owner_gid),
symlink_target: self::present(symlink_target),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::FileEntry> for types::FileEntry {
fn from(message: wire::FileEntry) -> Self {
let wire::FileEntry {
name,
r#type,
size_bytes,
modify_time,
mode,
owner_uid,
owner_gid,
symlink_target,
__buffa_unknown_fields: _,
} = message;
Self {
name: name.unwrap_or_default(),
r#type: r#type.map(file_type_from_wire).unwrap_or_default(),
size_bytes: size_bytes.unwrap_or_default(),
modify_time: modify_time.into_option().map(crate::timestamp::from_wire),
mode: mode.unwrap_or_default(),
owner_uid: owner_uid.unwrap_or_default(),
owner_gid: owner_gid.unwrap_or_default(),
symlink_target: symlink_target.unwrap_or_default(),
}
}
}
impl From<types::ReadPathRequest> for wire::ReadPathRequest {
fn from(message: types::ReadPathRequest) -> Self {
let types::ReadPathRequest {
project_id,
root,
path,
entry_limit,
offset_bytes,
length_bytes,
entry_page_token,
} = message;
Self {
project_id: self::present(project_id),
root: match root {
Some(types::ReadPathRequestRoot::Service(value)) => {
Some(wire::__buffa::oneof::read_path_request::Root::Service(value))
}
Some(types::ReadPathRequestRoot::Volume(value)) => {
Some(wire::__buffa::oneof::read_path_request::Root::Volume(value))
}
None => None,
},
path: self::present(path),
entry_limit: self::present(entry_limit),
offset_bytes: self::present(offset_bytes),
length_bytes: self::present(length_bytes),
entry_page_token: self::present(entry_page_token),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::ReadPathRequest> for types::ReadPathRequest {
fn from(message: wire::ReadPathRequest) -> Self {
let wire::ReadPathRequest {
project_id,
root,
path,
entry_limit,
offset_bytes,
length_bytes,
entry_page_token,
__buffa_unknown_fields: _,
} = message;
Self {
project_id: project_id.unwrap_or_default(),
root: match root {
Some(wire::__buffa::oneof::read_path_request::Root::Service(value)) => {
Some(types::ReadPathRequestRoot::Service(value))
}
Some(wire::__buffa::oneof::read_path_request::Root::Volume(value)) => {
Some(types::ReadPathRequestRoot::Volume(value))
}
None => None,
},
path: path.unwrap_or_default(),
entry_limit: entry_limit.unwrap_or_default(),
offset_bytes: offset_bytes.unwrap_or_default(),
length_bytes: length_bytes.unwrap_or_default(),
entry_page_token: entry_page_token.unwrap_or_default(),
}
}
}
impl From<types::ReadPathResponse> for wire::ReadPathResponse {
fn from(message: types::ReadPathResponse) -> Self {
let types::ReadPathResponse {
entry,
location,
volume,
entries,
entry_count,
next_entry_page_token,
text,
binary,
next_offset_bytes,
deploy_id,
} = message;
Self {
entry: entry.map(wire::FileEntry::from).into(),
location: self::present(location).map(file_location_to_wire),
volume: self::present(volume),
entries: entries.into_iter().map(wire::FileEntry::from).collect(),
entry_count: self::present(entry_count),
next_entry_page_token: self::present(next_entry_page_token),
text: self::present(text),
binary: self::present(binary),
next_offset_bytes: self::present(next_offset_bytes),
deploy_id: self::present(deploy_id),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::ReadPathResponse> for types::ReadPathResponse {
fn from(message: wire::ReadPathResponse) -> Self {
let wire::ReadPathResponse {
entry,
location,
volume,
entries,
entry_count,
next_entry_page_token,
text,
binary,
next_offset_bytes,
deploy_id,
__buffa_unknown_fields: _,
} = message;
Self {
entry: entry.into_option().map(types::FileEntry::from),
location: location.map(file_location_from_wire).unwrap_or_default(),
volume: volume.unwrap_or_default(),
entries: entries.into_iter().map(types::FileEntry::from).collect(),
entry_count: entry_count.unwrap_or_default(),
next_entry_page_token: next_entry_page_token.unwrap_or_default(),
text: text.unwrap_or_default(),
binary: binary.unwrap_or_default(),
next_offset_bytes: next_offset_bytes.unwrap_or_default(),
deploy_id: deploy_id.unwrap_or_default(),
}
}
}
impl From<types::CreateTransferRequest> for wire::CreateTransferRequest {
fn from(message: types::CreateTransferRequest) -> Self {
let types::CreateTransferRequest { transfer } = message;
Self {
transfer: match transfer {
Some(types::CreateTransferRequestTransfer::UploadArchive(value)) => {
Some(wire::__buffa::oneof::create_transfer_request::Transfer::UploadArchive(
Box::new(wire::ArchiveUpload::from(value)),
))
}
Some(types::CreateTransferRequestTransfer::UploadFile(value)) => {
Some(wire::__buffa::oneof::create_transfer_request::Transfer::UploadFile(
Box::new(wire::FileUpload::from(value)),
))
}
Some(types::CreateTransferRequestTransfer::Download(value)) => {
Some(wire::__buffa::oneof::create_transfer_request::Transfer::Download(
Box::new(wire::PathDownload::from(value)),
))
}
Some(types::CreateTransferRequestTransfer::DownloadDatabase(value)) => Some(
wire::__buffa::oneof::create_transfer_request::Transfer::DownloadDatabase(Box::new(
wire::DatabaseDump::from(value),
)),
),
None => None,
},
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::CreateTransferRequest> for types::CreateTransferRequest {
fn from(message: wire::CreateTransferRequest) -> Self {
let wire::CreateTransferRequest {
transfer,
__buffa_unknown_fields: _,
} = message;
Self {
transfer: match transfer {
Some(wire::__buffa::oneof::create_transfer_request::Transfer::UploadArchive(value)) => Some(
types::CreateTransferRequestTransfer::UploadArchive(types::ArchiveUpload::from(*value)),
),
Some(wire::__buffa::oneof::create_transfer_request::Transfer::UploadFile(value)) => Some(
types::CreateTransferRequestTransfer::UploadFile(types::FileUpload::from(*value)),
),
Some(wire::__buffa::oneof::create_transfer_request::Transfer::Download(value)) => Some(
types::CreateTransferRequestTransfer::Download(types::PathDownload::from(*value)),
),
Some(wire::__buffa::oneof::create_transfer_request::Transfer::DownloadDatabase(value)) => Some(
types::CreateTransferRequestTransfer::DownloadDatabase(types::DatabaseDump::from(*value)),
),
None => None,
},
}
}
}
impl From<types::ArchiveUpload> for wire::ArchiveUpload {
fn from(message: types::ArchiveUpload) -> Self {
let types::ArchiveUpload { file_name } = message;
Self {
file_name: self::present(file_name),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::ArchiveUpload> for types::ArchiveUpload {
fn from(message: wire::ArchiveUpload) -> Self {
let wire::ArchiveUpload {
file_name,
__buffa_unknown_fields: _,
} = message;
Self {
file_name: file_name.unwrap_or_default(),
}
}
}
impl From<types::FileUpload> for wire::FileUpload {
fn from(message: types::FileUpload) -> Self {
let types::FileUpload { project_id, root, path } = message;
Self {
project_id: self::present(project_id),
root: match root {
Some(types::FileUploadRoot::Service(value)) => {
Some(wire::__buffa::oneof::file_upload::Root::Service(value))
}
Some(types::FileUploadRoot::Volume(value)) => {
Some(wire::__buffa::oneof::file_upload::Root::Volume(value))
}
None => None,
},
path: self::present(path),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::FileUpload> for types::FileUpload {
fn from(message: wire::FileUpload) -> Self {
let wire::FileUpload {
project_id,
root,
path,
__buffa_unknown_fields: _,
} = message;
Self {
project_id: project_id.unwrap_or_default(),
root: match root {
Some(wire::__buffa::oneof::file_upload::Root::Service(value)) => {
Some(types::FileUploadRoot::Service(value))
}
Some(wire::__buffa::oneof::file_upload::Root::Volume(value)) => {
Some(types::FileUploadRoot::Volume(value))
}
None => None,
},
path: path.unwrap_or_default(),
}
}
}
impl From<types::PathDownload> for wire::PathDownload {
fn from(message: types::PathDownload) -> Self {
let types::PathDownload { project_id, root, path } = message;
Self {
project_id: self::present(project_id),
root: match root {
Some(types::PathDownloadRoot::Service(value)) => {
Some(wire::__buffa::oneof::path_download::Root::Service(value))
}
Some(types::PathDownloadRoot::Volume(value)) => {
Some(wire::__buffa::oneof::path_download::Root::Volume(value))
}
None => None,
},
path: self::present(path),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::PathDownload> for types::PathDownload {
fn from(message: wire::PathDownload) -> Self {
let wire::PathDownload {
project_id,
root,
path,
__buffa_unknown_fields: _,
} = message;
Self {
project_id: project_id.unwrap_or_default(),
root: match root {
Some(wire::__buffa::oneof::path_download::Root::Service(value)) => {
Some(types::PathDownloadRoot::Service(value))
}
Some(wire::__buffa::oneof::path_download::Root::Volume(value)) => {
Some(types::PathDownloadRoot::Volume(value))
}
None => None,
},
path: path.unwrap_or_default(),
}
}
}
impl From<types::DatabaseDump> for wire::DatabaseDump {
fn from(message: types::DatabaseDump) -> Self {
let types::DatabaseDump { project_id, database } = message;
Self {
project_id: self::present(project_id),
database: self::present(database),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::DatabaseDump> for types::DatabaseDump {
fn from(message: wire::DatabaseDump) -> Self {
let wire::DatabaseDump {
project_id,
database,
__buffa_unknown_fields: _,
} = message;
Self {
project_id: project_id.unwrap_or_default(),
database: database.unwrap_or_default(),
}
}
}
impl From<types::CreateTransferResponse> for wire::CreateTransferResponse {
fn from(message: types::CreateTransferResponse) -> Self {
let types::CreateTransferResponse {
url,
http_method,
expire_time,
command,
upload_id,
replaces,
file_name,
exclude_names,
} = message;
Self {
url: self::present(url),
http_method: self::present(http_method),
expire_time: expire_time.map(crate::timestamp::to_wire).into(),
command: self::present(command),
upload_id: self::present(upload_id),
replaces: self::present(replaces),
file_name: self::present(file_name),
exclude_names,
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::CreateTransferResponse> for types::CreateTransferResponse {
fn from(message: wire::CreateTransferResponse) -> Self {
let wire::CreateTransferResponse {
url,
http_method,
expire_time,
command,
upload_id,
replaces,
file_name,
exclude_names,
__buffa_unknown_fields: _,
} = message;
Self {
url: url.unwrap_or_default(),
http_method: http_method.unwrap_or_default(),
expire_time: expire_time.into_option().map(crate::timestamp::from_wire),
command: command.unwrap_or_default(),
upload_id: upload_id.unwrap_or_default(),
replaces: replaces.unwrap_or_default(),
file_name: file_name.unwrap_or_default(),
exclude_names,
}
}
}
impl From<types::ProjectBusy> for wire::ProjectBusy {
fn from(message: types::ProjectBusy) -> Self {
let types::ProjectBusy {
operation_id,
kind,
start_time,
} = message;
Self {
operation_id: self::present(operation_id),
kind: self::present(kind).map(operation_kind_to_wire),
start_time: start_time.map(crate::timestamp::to_wire).into(),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::ProjectBusy> for types::ProjectBusy {
fn from(message: wire::ProjectBusy) -> Self {
let wire::ProjectBusy {
operation_id,
kind,
start_time,
__buffa_unknown_fields: _,
} = message;
Self {
operation_id: operation_id.unwrap_or_default(),
kind: kind.map(operation_kind_from_wire).unwrap_or_default(),
start_time: start_time.into_option().map(crate::timestamp::from_wire),
}
}
}
impl From<types::ProjectChanged> for wire::ProjectChanged {
fn from(message: types::ProjectChanged) -> Self {
let types::ProjectChanged {} = message;
Self {
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::ProjectChanged> for types::ProjectChanged {
fn from(message: wire::ProjectChanged) -> Self {
let wire::ProjectChanged {
__buffa_unknown_fields: _,
} = message;
Self {}
}
}
impl From<types::MachineUnreachable> for wire::MachineUnreachable {
fn from(message: types::MachineUnreachable) -> Self {
let types::MachineUnreachable { since_time } = message;
Self {
since_time: since_time.map(crate::timestamp::to_wire).into(),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::MachineUnreachable> for types::MachineUnreachable {
fn from(message: wire::MachineUnreachable) -> Self {
let wire::MachineUnreachable {
since_time,
__buffa_unknown_fields: _,
} = message;
Self {
since_time: since_time.into_option().map(crate::timestamp::from_wire),
}
}
}
impl From<types::MachineUpdatePending> for wire::MachineUpdatePending {
fn from(message: types::MachineUpdatePending) -> Self {
let types::MachineUpdatePending {} = message;
Self {
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::MachineUpdatePending> for types::MachineUpdatePending {
fn from(message: wire::MachineUpdatePending) -> Self {
let wire::MachineUpdatePending {
__buffa_unknown_fields: _,
} = message;
Self {}
}
}
impl From<types::DatabaseLinkRefusal> for wire::DatabaseLinkRefusal {
fn from(message: types::DatabaseLinkRefusal) -> Self {
let types::DatabaseLinkRefusal {
project_id,
reason,
service,
} = message;
Self {
project_id: self::present(project_id),
reason: self::present(reason).map(database_link_refusal_reason_to_wire),
service: self::present(service),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::DatabaseLinkRefusal> for types::DatabaseLinkRefusal {
fn from(message: wire::DatabaseLinkRefusal) -> Self {
let wire::DatabaseLinkRefusal {
project_id,
reason,
service,
__buffa_unknown_fields: _,
} = message;
Self {
project_id: project_id.unwrap_or_default(),
reason: reason.map(database_link_refusal_reason_from_wire).unwrap_or_default(),
service: service.unwrap_or_default(),
}
}
}
impl From<types::NoMachine> for wire::NoMachine {
fn from(message: types::NoMachine) -> Self {
let types::NoMachine { reason, url } = message;
Self {
reason: self::present(reason).map(no_machine_reason_to_wire),
url: self::present(url),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::NoMachine> for types::NoMachine {
fn from(message: wire::NoMachine) -> Self {
let wire::NoMachine {
reason,
url,
__buffa_unknown_fields: _,
} = message;
Self {
reason: reason.map(no_machine_reason_from_wire).unwrap_or_default(),
url: url.unwrap_or_default(),
}
}
}
impl From<types::WatchOperationRequest> for wire::WatchOperationRequest {
fn from(message: types::WatchOperationRequest) -> Self {
let types::WatchOperationRequest {
project_id,
operation_id,
} = message;
Self {
project_id: self::present(project_id),
operation_id: self::present(operation_id),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::WatchOperationRequest> for types::WatchOperationRequest {
fn from(message: wire::WatchOperationRequest) -> Self {
let wire::WatchOperationRequest {
project_id,
operation_id,
__buffa_unknown_fields: _,
} = message;
Self {
project_id: project_id.unwrap_or_default(),
operation_id: operation_id.unwrap_or_default(),
}
}
}
impl From<types::WatchOperationResponse> for wire::WatchOperationResponse {
fn from(message: types::WatchOperationResponse) -> Self {
let types::WatchOperationResponse { message } = message;
Self {
message: match message {
Some(types::WatchOperationResponseMessage::Log(value)) => {
Some(wire::__buffa::oneof::watch_operation_response::Message::Log(Box::new(
wire::OperationLogLine::from(value),
)))
}
Some(types::WatchOperationResponseMessage::FinishedOperation(value)) => Some(
wire::__buffa::oneof::watch_operation_response::Message::FinishedOperation(Box::new(
wire::Operation::from(value),
)),
),
None | Some(types::WatchOperationResponseMessage::Unrecognized) => None,
},
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::WatchOperationResponse> for types::WatchOperationResponse {
fn from(message: wire::WatchOperationResponse) -> Self {
let wire::WatchOperationResponse {
message,
__buffa_unknown_fields,
} = message;
Self {
message: match message {
Some(wire::__buffa::oneof::watch_operation_response::Message::Log(value)) => Some(
types::WatchOperationResponseMessage::Log(types::OperationLogLine::from(*value)),
),
Some(wire::__buffa::oneof::watch_operation_response::Message::FinishedOperation(value)) => Some(
types::WatchOperationResponseMessage::FinishedOperation(types::Operation::from(*value)),
),
None if !__buffa_unknown_fields.is_empty() => Some(types::WatchOperationResponseMessage::Unrecognized),
None => None,
},
}
}
}
impl From<types::TailContainerLogsRequest> for wire::TailContainerLogsRequest {
fn from(message: types::TailContainerLogsRequest) -> Self {
let types::TailContainerLogsRequest {
project_id,
filter,
after_cursor,
} = message;
Self {
project_id: self::present(project_id),
filter: filter.map(wire::ContainerLogFilter::from).into(),
after_cursor: self::present(after_cursor),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::TailContainerLogsRequest> for types::TailContainerLogsRequest {
fn from(message: wire::TailContainerLogsRequest) -> Self {
let wire::TailContainerLogsRequest {
project_id,
filter,
after_cursor,
__buffa_unknown_fields: _,
} = message;
Self {
project_id: project_id.unwrap_or_default(),
filter: filter.into_option().map(types::ContainerLogFilter::from),
after_cursor: after_cursor.unwrap_or_default(),
}
}
}
impl From<types::TailContainerLogsResponse> for wire::TailContainerLogsResponse {
fn from(message: types::TailContainerLogsResponse) -> Self {
let types::TailContainerLogsResponse { line, cursor } = message;
Self {
line: line.map(wire::LogLine::from).into(),
cursor: self::present(cursor),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::TailContainerLogsResponse> for types::TailContainerLogsResponse {
fn from(message: wire::TailContainerLogsResponse) -> Self {
let wire::TailContainerLogsResponse {
line,
cursor,
__buffa_unknown_fields: _,
} = message;
Self {
line: line.into_option().map(types::LogLine::from),
cursor: cursor.unwrap_or_default(),
}
}
}
impl From<types::TailHttpTrafficRequest> for wire::TailHttpTrafficRequest {
fn from(message: types::TailHttpTrafficRequest) -> Self {
let types::TailHttpTrafficRequest {
project_id,
filter,
after_sequence,
} = message;
Self {
project_id: self::present(project_id),
filter: filter.map(wire::HttpTrafficFilter::from).into(),
after_sequence: self::present(after_sequence),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::TailHttpTrafficRequest> for types::TailHttpTrafficRequest {
fn from(message: wire::TailHttpTrafficRequest) -> Self {
let wire::TailHttpTrafficRequest {
project_id,
filter,
after_sequence,
__buffa_unknown_fields: _,
} = message;
Self {
project_id: project_id.unwrap_or_default(),
filter: filter.into_option().map(types::HttpTrafficFilter::from),
after_sequence: after_sequence.unwrap_or_default(),
}
}
}
impl From<types::TailHttpTrafficResponse> for wire::TailHttpTrafficResponse {
fn from(message: types::TailHttpTrafficResponse) -> Self {
let types::TailHttpTrafficResponse { request } = message;
Self {
request: request.map(wire::HttpRequest::from).into(),
__buffa_unknown_fields: Default::default(),
}
}
}
impl From<wire::TailHttpTrafficResponse> for types::TailHttpTrafficResponse {
fn from(message: wire::TailHttpTrafficResponse) -> Self {
let wire::TailHttpTrafficResponse {
request,
__buffa_unknown_fields: _,
} = message;
Self {
request: request.into_option().map(types::HttpRequest::from),
}
}
}