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

Rename allow ip to ip allow #471

Closed
wants to merge 1 commit into from
Closed
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 docs/recipes/register_cluster.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ This creates read/write credentials on all of the registered clusters that match
Finally we need the cluster to allow requests from our IP address, this can be done as follows:

```
> curl ipconfig.me | allow ip --clusters .*
> curl ifconfig.me | ip allow --clusters .*
```

The curl command returns our IP address, which we then pipe into `allow ip` and this is run against all of the registered clusters again.
The curl command returns our IP address, which we then pipe into `ip allow` and this is run against all of the registered clusters again.
Now all of the healthy clusters are registered and ready to use through the shell.


Expand Down
18 changes: 9 additions & 9 deletions src/cli/allow_ip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ use std::sync::{Arc, Mutex};
use tokio::time::Instant;

#[derive(Clone)]
pub struct AllowIP {
pub struct IPAllow {
state: Arc<Mutex<State>>,
}

impl crate::cli::AllowIP {
impl crate::cli::IPAllow {
pub fn new(state: Arc<Mutex<State>>) -> Self {
Self { state }
}
}

impl Command for crate::cli::AllowIP {
impl Command for crate::cli::IPAllow {
fn name(&self) -> &str {
"allow ip"
"ip allow"
}

fn signature(&self) -> Signature {
Signature::build("allow ip")
Signature::build("ip allow")
.category(Category::Custom("couchbase".to_string()))
.named(
"clusters",
Expand All @@ -46,7 +46,7 @@ impl Command for crate::cli::AllowIP {
}

fn usage(&self) -> &str {
"Adds IP address to allowlist on a Capella cluster"
"Adds IP address to allow list on a Capella cluster"
}

fn run(
Expand All @@ -56,11 +56,11 @@ impl Command for crate::cli::AllowIP {
call: &Call,
input: PipelineData,
) -> Result<PipelineData, ShellError> {
allow_ip(self.state.clone(), engine_state, stack, call, input)
ip_allow(self.state.clone(), engine_state, stack, call, input)
}
}

fn allow_ip(
fn ip_allow(
state: Arc<Mutex<State>>,
engine_state: &EngineState,
stack: &mut Stack,
Expand All @@ -73,7 +73,7 @@ fn allow_ip(
let cluster_identifiers = cluster_identifiers_from(engine_state, stack, &state, call, true)?;
let guard = state.lock().unwrap();

debug!("Running allow_ip");
debug!("Running ip_allow");

let ip_address = match input.into_value(span)? {
Value::String { val, .. } => format_ip_address(val),
Expand Down
2 changes: 1 addition & 1 deletion src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ mod vector_enrich_text;
mod vector_search;
mod version;

pub use allow_ip::AllowIP;
pub use allow_ip::IPAllow;
pub use analytics::Analytics;
pub use analytics_buckets::AnalyticsBuckets;
pub use analytics_datasets::AnalyticsDatasets;
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ fn make_state(
fn merge_couchbase_delta(context: &mut EngineState, state: Arc<Mutex<State>>) {
let delta = {
let mut working_set = StateWorkingSet::new(context);
working_set.add_decl(Box::new(AllowIP::new(state.clone())));
working_set.add_decl(Box::new(IPAllow::new(state.clone())));
working_set.add_decl(Box::new(Analytics::new(state.clone())));
working_set.add_decl(Box::new(AnalyticsBuckets::new(state.clone())));
working_set.add_decl(Box::new(AnalyticsDatasets::new(state.clone())));
Expand Down
Loading