Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(rust): rename cloud module to orchestrator #8758

Merged
merged 2 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/actions/build_binaries/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ runs:
fi

if [[ $use_cross_build == "true" ]]; then
cross build --bin ockam --target ${{ inputs.target }} --release --no-default-features -F ockam_command/aws-lc -F ockam_command/admin_commands -F ockam_command/advanced_commands
cross build --bin ockam --target ${{ inputs.target }} --release --no-default-features -F ockam_command/aws-lc
else
cargo build --bin ockam --target ${{ inputs.target }} --release --no-default-features -F ockam_command/aws-lc -F ockam_command/admin_commands -F ockam_command/advanced_commands
cargo build --bin ockam --target ${{ inputs.target }} --release --no-default-features -F ockam_command/aws-lc
fi

cp target/${{ inputs.target }}/release/ockam target/${{ inputs.target }}/release/ockam_command
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use ockam_core::async_trait;
use ockam_node::Context;

use crate::authenticator::direct::types::AddMember;
use crate::cloud::{AuthorityNodeClient, HasSecureClient};
use crate::nodes::service::default_address::DefaultAddress;
use crate::orchestrator::{AuthorityNodeClient, HasSecureClient};

#[async_trait]
pub trait Members {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use ockam_core::async_trait;
use ockam_node::Context;

use crate::authenticator::one_time_code::OneTimeCode;
use crate::cloud::{AuthorityNodeClient, HasSecureClient};
use crate::nodes::service::default_address::DefaultAddress;
use crate::orchestrator::{AuthorityNodeClient, HasSecureClient};

#[async_trait]
pub trait TokenAcceptor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use ockam_node::Context;

use crate::authenticator::direct::types::CreateToken;
use crate::authenticator::one_time_code::OneTimeCode;
use crate::cloud::{AuthorityNodeClient, HasSecureClient};
use crate::nodes::service::default_address::DefaultAddress;
use crate::orchestrator::{AuthorityNodeClient, HasSecureClient};

#[async_trait]
pub trait TokenIssuer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,10 @@ mod tests {
use crate::authenticator::one_time_code::OneTimeCode;
use crate::authenticator::{PreTrustedIdentities, PreTrustedIdentity};
use crate::authority_node;
use crate::cloud::AuthorityNodeClient;
use crate::config::lookup::InternetAddress;
use crate::enroll::enrollment::{EnrollStatus, Enrollment};
use crate::nodes::NodeManager;
use crate::orchestrator::AuthorityNodeClient;
use ockam::identity::{identities, secure_channels, TimestampInSeconds};
use ockam_core::TryClone;
use ockam_multiaddr::MultiAddr;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::authenticator::one_time_code::OneTimeCode;
use crate::cli_state::Result;
use crate::cli_state::{CliState, CliStateError};
use crate::cloud::email_address::EmailAddress;
use crate::cloud::project::models::ProjectModel;
use crate::colors::{color_ok, color_primary, color_warn};
use crate::error::ApiError;
use crate::orchestrator::email_address::EmailAddress;
use crate::orchestrator::project::models::ProjectModel;
use crate::output::human_readable_time;
use crate::terminal::fmt;
use ockam::identity::{Identifier, Identity, TimestampInSeconds, Vault};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use crate::cli_state::journeys::attributes::{
default_attributes, make_host, make_host_trace_id, make_journey_span_id, make_project_trace_id,
};
use crate::cli_state::journeys::{Journey, JourneyEvent, ProjectJourney};
use crate::cloud::project::Project;
use crate::logs::CurrentSpan;
use crate::orchestrator::project::Project;
use crate::{CliState, Result};
use chrono::{DateTime, Utc};
use either::Either;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ use ockam_core::Error;
use ockam_vault::SoftwareVaultForVerifyingSignatures;

use crate::cli_state::{CliState, EnrollmentFilter, ProjectsRepository};
use crate::cloud::email_address::EmailAddress;
use crate::cloud::project::models::ProjectModel;
use crate::cloud::project::Project;
use crate::cloud::share::RoleInShare;
use crate::orchestrator::email_address::EmailAddress;
use crate::orchestrator::project::models::ProjectModel;
use crate::orchestrator::project::Project;
use crate::orchestrator::share::RoleInShare;

use super::Result;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use ockam_core::errcode::{Kind, Origin};
use ockam_core::Error;

use crate::cli_state::CliState;
use crate::cloud::space::Space;
use crate::cloud::subscription::Subscription;
use crate::orchestrator::space::Space;
use crate::orchestrator::subscription::Subscription;

use super::Result;

Expand Down Expand Up @@ -81,7 +81,7 @@ impl CliState {
#[cfg(test)]
mod test {
use super::*;
use crate::cloud::subscription::SubscriptionName;
use crate::orchestrator::subscription::SubscriptionName;
use ockam_node::database::skip_if_postgres;

#[tokio::test]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::cli_state::enrollments::IdentityEnrollment;
use crate::cloud::email_address::EmailAddress;
use crate::orchestrator::email_address::EmailAddress;
use ockam::identity::Identifier;
use ockam_core::async_trait;
use ockam_core::Result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use time::OffsetDateTime;

use crate::cli_state::enrollments::IdentityEnrollment;
use crate::cli_state::EnrollmentsRepository;
use crate::cloud::email_address::EmailAddress;
use crate::orchestrator::email_address::EmailAddress;
use ockam::identity::Identifier;
use ockam::{FromSqlxError, SqlxDatabase, ToVoid};
use ockam_core::async_trait;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::cloud::project::models::ProjectModel;
use crate::orchestrator::project::models::ProjectModel;
use ockam_core::async_trait;
use ockam_core::Result;
use ockam_node::database::AutoRetry;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::cloud::addon::KafkaConfig;
use crate::cloud::email_address::EmailAddress;
use crate::cloud::project::models::{OktaConfig, ProjectModel, ProjectUserRole};
use crate::cloud::share::{RoleInShare, ShareScope};
use crate::minicbor_url::Url;
use crate::orchestrator::addon::KafkaConfig;
use crate::orchestrator::email_address::EmailAddress;
use crate::orchestrator::project::models::{OktaConfig, ProjectModel, ProjectUserRole};
use crate::orchestrator::share::{RoleInShare, ShareScope};
use itertools::Itertools;
use ockam::identity::Identifier;
use ockam_core::async_trait;
Expand Down Expand Up @@ -634,7 +634,7 @@ mod test {
use crate::cli_state::{
SpacesRepository, SpacesSqlxDatabase, UsersRepository, UsersSqlxDatabase,
};
use crate::cloud::enroll::auth0::UserInfo;
use crate::orchestrator::enroll::auth0::UserInfo;
use ockam_node::database::with_sqlite_dbs;
use std::sync::Arc;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::cloud::space::Space;
use crate::orchestrator::space::Space;
use ockam_core::async_trait;
use ockam_core::Result;
use ockam_node::database::AutoRetry;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::SpacesRepository;
use crate::cloud::space::Space;
use crate::cloud::subscription::{Subscription, SubscriptionName};
use crate::orchestrator::space::Space;
use crate::orchestrator::subscription::{Subscription, SubscriptionName};
use ockam_core::async_trait;
use ockam_core::Result;
use ockam_node::database::AutoRetry;
Expand Down Expand Up @@ -332,7 +332,7 @@ impl SubscriptionRow {
#[cfg(test)]
mod test {
use super::*;
use crate::cloud::subscription::SubscriptionName;
use crate::orchestrator::subscription::SubscriptionName;
use ockam_node::database::with_sqlite_dbs;
use std::ops::Add;
use time::ext::NumericalDuration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::cloud::email_address::EmailAddress;
use crate::cloud::enroll::auth0::UserInfo;
use crate::orchestrator::email_address::EmailAddress;
use crate::orchestrator::enroll::auth0::UserInfo;
use ockam_core::async_trait;
use ockam_core::Result;
use ockam_node::database::AutoRetry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use itertools::Itertools;
use sqlx::*;
use std::sync::Arc;

use crate::cloud::email_address::EmailAddress;
use crate::cloud::enroll::auth0::UserInfo;
use crate::orchestrator::email_address::EmailAddress;
use crate::orchestrator::enroll::auth0::UserInfo;
use ockam_core::async_trait;
use ockam_core::Result;
use ockam_node::database::AutoRetry;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::cloud::project::Project;
use crate::nodes::service::{
CredentialScope, NodeManagerCredentialRetrieverOptions, NodeManagerTrustOptions,
};
use crate::nodes::NodeManager;
use crate::orchestrator::project::Project;
use crate::{ApiError, CliState, TransportRouteResolver};
use ockam::identity::models::ChangeHistory;
use ockam::identity::{IdentitiesVerification, RemoteCredentialRetrieverInfo};
Expand Down
4 changes: 2 additions & 2 deletions implementations/rust/ockam/ockam_api/src/cli_state/users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use ockam_core::Error;

use crate::cli_state::CliState;
use crate::cli_state::Result;
use crate::cloud::email_address::EmailAddress;
use crate::cloud::enroll::auth0::UserInfo;
use crate::orchestrator::email_address::EmailAddress;
use crate::orchestrator::enroll::auth0::UserInfo;

impl CliState {
#[instrument(skip_all, fields(user = %user))]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::authenticator::one_time_code::OneTimeCode;
use crate::cloud::enroll::auth0::{AuthenticateOidcToken, OidcToken};
use crate::cloud::HasSecureClient;
use crate::nodes::service::default_address::DefaultAddress;
use crate::orchestrator::enroll::auth0::{AuthenticateOidcToken, OidcToken};
use crate::orchestrator::HasSecureClient;
use miette::IntoDiagnostic;
use ockam::identity::models::CredentialAndPurposeKey;
use ockam::identity::SecureClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ use tokio::time::Duration;
use tokio_retry::{strategy::ExponentialBackoff, Retry};
use tracing::{error, info};

use crate::cloud::enroll::auth0::{AuthorizationCode, DeviceCode, OidcToken, UserInfo};
use crate::enroll::ockam_oidc_provider::{authenticator_endpoint, OckamOidcProvider};
use crate::enroll::oidc_provider::OidcProvider;
use crate::error::ApiError;
use crate::orchestrator::enroll::auth0::{AuthorizationCode, DeviceCode, OidcToken, UserInfo};
use ockam::compat::fmt::Debug;
use ockam_core::compat::rand::{thread_rng, RngCore};
use ockam_core::Result;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::cloud::project::models::OktaAuth0;
use crate::orchestrator::project::models::OktaAuth0;
use ockam_core::Result;
use std::time::Duration;
use url::Url;
Expand Down
2 changes: 1 addition & 1 deletion implementations/rust/ockam/ockam_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ extern crate tracing;
pub mod address;
pub mod authenticator;
pub mod cli_state;
pub mod cloud;
pub mod config;
pub mod echoer;
pub mod enroll;
Expand All @@ -32,6 +31,7 @@ pub mod kafka;
pub mod minicbor_url;
pub mod nodes;
pub mod okta;
pub mod orchestrator;
pub mod port_range;
pub mod session;
pub mod uppercase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ use ockam_multiaddr::MultiAddr;

use crate::cli_state::random_name;
use crate::cli_state::CliState;
use crate::cloud::project::Project;
use crate::cloud::{AuthorityNodeClient, ControllerClient, CredentialsEnabled, ProjectNodeClient};
use crate::nodes::models::transport::Port;
use crate::nodes::service::default_address::DefaultAddress;
use crate::nodes::service::{
NodeManagerGeneralOptions, NodeManagerTransportOptions, NodeManagerTrustOptions,
};
use crate::nodes::{NodeManager, NODEMANAGER_ADDR};
use crate::orchestrator::project::Project;
use crate::orchestrator::{
AuthorityNodeClient, ControllerClient, CredentialsEnabled, ProjectNodeClient,
};

/// An `InMemoryNode` represents a full running node
/// In addition to a `NodeManager`, which is used to handle all the entities related to a node
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use crate::cloud::project::Project;
use crate::cloud::{AuthorityNodeClient, ControllerClient, CredentialsEnabled, ProjectNodeClient};
use crate::nodes::connection::{
Connection, ConnectionBuilder, PlainTcpInstantiator, PlainUdpInstantiator, ProjectInstantiator,
SecureChannelInstantiator,
Expand All @@ -12,6 +10,10 @@ use crate::nodes::service::{
CredentialRetrieverCreators, NodeManagerCredentialRetrieverOptions, NodeManagerTrustOptions,
SecureChannelType,
};
use crate::orchestrator::project::Project;
use crate::orchestrator::{
AuthorityNodeClient, ControllerClient, CredentialsEnabled, ProjectNodeClient,
};

use crate::cli_state::journeys::{NODE_NAME, USER_EMAIL, USER_NAME};
use crate::logs::CurrentSpan;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::cloud::email_address::EmailAddress;
use crate::cloud::project::models::{AdminInfo, OrchestratorVersionInfo};
use crate::cloud::project::{Project, ProjectsOrchestratorApi};
use crate::nodes::InMemoryNode;
use crate::orchestrator::email_address::EmailAddress;
use crate::orchestrator::project::models::{AdminInfo, OrchestratorVersionInfo};
use crate::orchestrator::project::{Project, ProjectsOrchestratorApi};
use miette::IntoDiagnostic;
use ockam_core::async_trait;
use ockam_node::Context;
Expand Down Expand Up @@ -231,7 +231,7 @@ impl ProjectsOrchestratorApi for InMemoryNode {
mod tests {
use crate::cli_state::projects::Projects;
use crate::cli_state::ProjectsSqlxDatabase;
use crate::cloud::project::models::ProjectModel;
use crate::orchestrator::project::models::ProjectModel;
use ockam::identity::{
identities, ChangeHistoryRepository, ChangeHistorySqlxDatabase, IdentitiesVerification,
};
Expand Down
3 changes: 2 additions & 1 deletion implementations/rust/ockam/ockam_api/src/okta/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ impl Server {
debug!("Checking token");
// TODO: check token_type
// TODO: it's AuthenticateAuth0Token or something else?. Probably rename.
let token: crate::cloud::enroll::auth0::AuthenticateOidcToken = dec.decode()?;
let token: crate::orchestrator::enroll::auth0::AuthenticateOidcToken =
dec.decode()?;
debug!("device code received: {token:#?}");
if let Some(attrs) = self.check_token(&token.access_token.0).await? {
//TODO in some future, we will want to track that this entry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ use ockam_core::api::Request;
use ockam_core::async_trait;
use ockam_node::Context;

use crate::cloud::operation::CreateOperationResponse;
use crate::cloud::project::models::{InfluxDBTokenLeaseManagerConfig, OktaConfig};
use crate::cloud::{ControllerClient, HasSecureClient};
use crate::orchestrator::operation::CreateOperationResponse;
use crate::orchestrator::project::models::{InfluxDBTokenLeaseManagerConfig, OktaConfig};
use crate::orchestrator::{ControllerClient, HasSecureClient};
use crate::output::Output;
use crate::Result;

const TARGET: &str = "ockam_api::cloud::addon";
const API_SERVICE: &str = "projects";

#[derive(Encode, Decode, CborLen, Serialize, Deserialize, Debug)]
Expand Down Expand Up @@ -117,7 +116,7 @@ pub trait Addons {
impl Addons for ControllerClient {
#[instrument(skip_all, fields(project_id = project_id))]
async fn list_addons(&self, ctx: &Context, project_id: &str) -> miette::Result<Vec<Addon>> {
trace!(target: TARGET, project_id, "listing addons");
trace!(project_id, "listing addons");
let req = Request::get(format!("/v0/{project_id}/addons"));
self.get_secure_client()
.ask(ctx, API_SERVICE, req)
Expand All @@ -133,7 +132,7 @@ impl Addons for ControllerClient {
project_id: &str,
config: KafkaConfig,
) -> miette::Result<CreateOperationResponse> {
trace!(target: TARGET, project_id, "configuring kafka addon");
trace!(project_id, "configuring kafka addon");
let req = Request::post(format!(
"/v1/projects/{project_id}/configure_addon/confluent"
))
Expand All @@ -152,7 +151,7 @@ impl Addons for ControllerClient {
project_id: &str,
config: OktaConfig,
) -> miette::Result<CreateOperationResponse> {
trace!(target: TARGET, project_id, "configuring okta addon");
trace!(project_id, "configuring okta addon");
let req =
Request::post(format!("/v1/projects/{project_id}/configure_addon/okta")).body(config);
self.get_secure_client()
Expand All @@ -170,7 +169,7 @@ impl Addons for ControllerClient {
config: InfluxDBTokenLeaseManagerConfig,
) -> miette::Result<CreateOperationResponse> {
//
trace!(target: TARGET, project_id, "configuring influxdb addon");
trace!(project_id, "configuring influxdb addon");
let req = Request::post(format!(
"/v1/projects/{project_id}/configure_addon/influxdb_token_lease_manager"
))
Expand All @@ -189,7 +188,7 @@ impl Addons for ControllerClient {
project_id: &str,
addon_id: &str,
) -> miette::Result<CreateOperationResponse> {
trace!(target: TARGET, project_id, "disabling addon");
trace!(project_id, "disabling addon");
let req = Request::post(format!("/v1/projects/{project_id}/disable_addon"))
.body(DisableAddon::new(addon_id));
self.get_secure_client()
Expand Down
Loading
Loading