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

feat(pubsub): Add pubsub config #750

Merged
merged 1 commit into from
Nov 2, 2017
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
182 changes: 182 additions & 0 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,16 @@
* [**hal config provider oraclebmcs account list**](#hal-config-provider-oraclebmcs-account-list)
* [**hal config provider oraclebmcs disable**](#hal-config-provider-oraclebmcs-disable)
* [**hal config provider oraclebmcs enable**](#hal-config-provider-oraclebmcs-enable)
* [**hal config pubsub**](#hal-config-pubsub)
* [**hal config pubsub google**](#hal-config-pubsub-google)
* [**hal config pubsub google disable**](#hal-config-pubsub-google-disable)
* [**hal config pubsub google enable**](#hal-config-pubsub-google-enable)
* [**hal config pubsub google subscription**](#hal-config-pubsub-google-subscription)
* [**hal config pubsub google subscription add**](#hal-config-pubsub-google-subscription-add)
* [**hal config pubsub google subscription delete**](#hal-config-pubsub-google-subscription-delete)
* [**hal config pubsub google subscription edit**](#hal-config-pubsub-google-subscription-edit)
* [**hal config pubsub google subscription get**](#hal-config-pubsub-google-subscription-get)
* [**hal config pubsub google subscription list**](#hal-config-pubsub-google-subscription-list)
* [**hal config security**](#hal-config-security)
* [**hal config security api**](#hal-config-security-api)
* [**hal config security api edit**](#hal-config-security-api-edit)
Expand Down Expand Up @@ -494,6 +504,7 @@ hal config [parameters] [subcommands]
* `metric-stores`: Configure Spinnaker's metric stores. This configuration only affects the publishing of metrics against whichever metric stores you enable (it can be more than one).
* `notification`: Display the state of Spinnaker's notification settings.
* `provider`: Configure, validate, and view the specified provider.
* `pubsub`: Configure, validate, and view the specified pubsub.
* `security`: Configure Spinnaker's security. This includes external SSL, authentication mechanisms, and authorization policies.
* `storage`: Show Spinnaker's persistent storage configuration.
* `version`: Configure & view the current deployment of Spinnaker's version.
Expand Down Expand Up @@ -3644,6 +3655,177 @@ hal config provider oraclebmcs enable [parameters]
* `--no-validate`: (*Default*: `false`) Skip validation.


---
## hal config pubsub

Configure, validate, and view the specified pubsub.

#### Usage
```
hal config pubsub [subcommands]
```

#### Subcommands
* `google`: Manage and view Spinnaker configuration for the google pubsub

---
## hal config pubsub google

Manage and view Spinnaker configuration for the google pubsub

#### Usage
```
hal config pubsub google [parameters] [subcommands]
```

#### Parameters
* `--deployment`: If supplied, use this Halyard deployment. This will _not_ create a new deployment.
* `--no-validate`: (*Default*: `false`) Skip validation.

#### Subcommands
* `disable`: Set the google pubsub as disabled
* `enable`: Set the google pubsub as enabled
* `subscription`: Manage and view Spinnaker configuration for the google pubsub's subscription

---
## hal config pubsub google disable

Set the google pubsub as disabled

#### Usage
```
hal config pubsub google disable [parameters]
```

#### Parameters
* `--deployment`: If supplied, use this Halyard deployment. This will _not_ create a new deployment.
* `--no-validate`: (*Default*: `false`) Skip validation.


---
## hal config pubsub google enable

Set the google pubsub as enabled

#### Usage
```
hal config pubsub google enable [parameters]
```

#### Parameters
* `--deployment`: If supplied, use this Halyard deployment. This will _not_ create a new deployment.
* `--no-validate`: (*Default*: `false`) Skip validation.


---
## hal config pubsub google subscription

Manage and view Spinnaker configuration for the google pubsub's subscription

#### Usage
```
hal config pubsub google subscription SUBSCRIPTION [parameters] [subcommands]
```

#### Parameters
`SUBSCRIPTION`: The name of the subscription to operate on.
* `--deployment`: If supplied, use this Halyard deployment. This will _not_ create a new deployment.
* `--no-validate`: (*Default*: `false`) Skip validation.

#### Subcommands
* `add`: Add an subscription to the google pubsub.
* `delete`: Delete a specific google subscription by name.
* `edit`: Edit an subscription in the google pubsub.
* `get`: Get the specified subscription details for the google pubsub.
* `list`: List the subscription names for the google pubsub.

---
## hal config pubsub google subscription add

Add an subscription to the google pubsub.

#### Usage
```
hal config pubsub google subscription add SUBSCRIPTION [parameters]
```

#### Parameters
`SUBSCRIPTION`: The name of the subscription to operate on.
* `--deployment`: If supplied, use this Halyard deployment. This will _not_ create a new deployment.
* `--json-path`: The path to a JSON service account that Spinnaker will use as credentials. This is only needed if Spinnaker is not deployed on a Google Compute Engine VM, or needs permissions not afforded to the VM it is running on. See https://cloud.google.com/compute/docs/access/service-accounts for more information.
* `--no-validate`: (*Default*: `false`) Skip validation.
* `--project`: The name of the GCP project your subscription lives in.
* `--subscription-name`: The name of the subscription to listen to. This identifier does not include the name of the project, and must already be configured for Spinnaker to work.
* `--template-path`: A path to a jinja template that specifies how artifacts from this pubsub system are interpreted and transformed into Spinnaker artifacts. See spinnaker.io/reference/artifacts for more information.


---
## hal config pubsub google subscription delete

Delete a specific google subscription by name.

#### Usage
```
hal config pubsub google subscription delete SUBSCRIPTION [parameters]
```

#### Parameters
`SUBSCRIPTION`: The name of the subscription to operate on.
* `--deployment`: If supplied, use this Halyard deployment. This will _not_ create a new deployment.
* `--no-validate`: (*Default*: `false`) Skip validation.


---
## hal config pubsub google subscription edit

Edit an subscription in the google pubsub.

#### Usage
```
hal config pubsub google subscription edit SUBSCRIPTION [parameters]
```

#### Parameters
`SUBSCRIPTION`: The name of the subscription to operate on.
* `--deployment`: If supplied, use this Halyard deployment. This will _not_ create a new deployment.
* `--json-path`: The path to a JSON service account that Spinnaker will use as credentials. This is only needed if Spinnaker is not deployed on a Google Compute Engine VM, or needs permissions not afforded to the VM it is running on. See https://cloud.google.com/compute/docs/access/service-accounts for more information.
* `--no-validate`: (*Default*: `false`) Skip validation.
* `--project`: The name of the GCP project your subscription lives in.
* `--subscription-name`: The name of the subscription to listen to. This identifier does not include the name of the project, and must already be configured for Spinnaker to work.
* `--template-path`: A path to a jinja template that specifies how artifacts from this pubsub system are interpreted and transformed into Spinnaker artifacts. See spinnaker.io/reference/artifacts for more information.


---
## hal config pubsub google subscription get

Get the specified subscription details for the google pubsub.

#### Usage
```
hal config pubsub google subscription get SUBSCRIPTION [parameters]
```

#### Parameters
`SUBSCRIPTION`: The name of the subscription to operate on.
* `--deployment`: If supplied, use this Halyard deployment. This will _not_ create a new deployment.
* `--no-validate`: (*Default*: `false`) Skip validation.


---
## hal config pubsub google subscription list

List the subscription names for the google pubsub.

#### Usage
```
hal config pubsub google subscription list [parameters]
```

#### Parameters
* `--deployment`: If supplied, use this Halyard deployment. This will _not_ create a new deployment.
* `--no-validate`: (*Default*: `false`) Skip validation.


---
## hal config security

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.ArtifactProviderCommand;
import com.netflix.spinnaker.halyard.cli.command.v1.config.ci.CiCommand;
import com.netflix.spinnaker.halyard.cli.command.v1.config.providers.ProviderCommand;
import com.netflix.spinnaker.halyard.cli.command.v1.config.pubsubs.PubsubCommand;
import com.netflix.spinnaker.halyard.cli.services.v1.Daemon;
import com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler;
import com.netflix.spinnaker.halyard.cli.ui.v1.AnsiFormatUtils;
Expand Down Expand Up @@ -58,6 +59,7 @@ public class ConfigCommand extends AbstractConfigCommand {
registerSubcommand(new NotificationCommand());
registerSubcommand(new PersistentStorageCommand());
registerSubcommand(new ProviderCommand());
registerSubcommand(new PubsubCommand());
registerSubcommand(new SecurityCommand());
registerSubcommand(new VersionConfigCommand());
registerSubcommand(new CiCommand());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
package com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.gcs;

import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.account.AbstractAddArtifactAccountCommand;
import com.netflix.spinnaker.halyard.cli.command.v1.config.providers.google.CommonGoogleCommandProperties;
import com.netflix.spinnaker.halyard.cli.command.v1.converter.PathExpandingConverter;
import com.netflix.spinnaker.halyard.config.model.v1.artifacts.gcs.GcsArtifactAccount;
import com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactAccount;

@Parameters(separators = "=")
public class GcsAddArtifactAccountCommand extends AbstractAddArtifactAccountCommand {
@Parameter(
names = "--json-path",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@

package com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.gcs;

import com.beust.jcommander.Parameters;
import com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.AbstractArtifactAccountCommand;

@Parameters(separators = "=")
public class GcsArtifactAccountCommand extends AbstractArtifactAccountCommand {
@Override
protected String getArtifactProviderName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@

package com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.gcs;

import com.beust.jcommander.Parameters;
import com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.AbstractNamedArtifactProviderCommand;

@Parameters(separators = "=")
public class GcsArtifactProviderCommand extends AbstractNamedArtifactProviderCommand {
@Override
protected String getArtifactProviderName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
package com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.gcs;

import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.account.AbstractArtifactEditAccountCommand;
import com.netflix.spinnaker.halyard.cli.command.v1.config.providers.google.CommonGoogleCommandProperties;
import com.netflix.spinnaker.halyard.cli.command.v1.converter.PathExpandingConverter;
import com.netflix.spinnaker.halyard.config.model.v1.artifacts.gcs.GcsArtifactAccount;
import com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactAccount;

@Parameters(separators = "=")
public class GcsEditArtifactAccountCommand extends AbstractArtifactEditAccountCommand<GcsArtifactAccount> {
@Parameter(
names = "--json-path",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Copyright 2017 Google, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/

package com.netflix.spinnaker.halyard.cli.command.v1.config.pubsubs;

import com.beust.jcommander.Parameters;
import com.netflix.spinnaker.halyard.cli.services.v1.Daemon;
import com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler;
import com.netflix.spinnaker.halyard.config.model.v1.node.Pubsub;

import static com.netflix.spinnaker.halyard.cli.ui.v1.AnsiFormatUtils.Format.STRING;

@Parameters(separators = "=")
public abstract class AbstractNamedPubsubCommand extends AbstractPubsubCommand {
@Override
public String getCommandName() {
return getPubsubName();
}

@Override
protected String getShortDescription() {
return "Manage and view Spinnaker configuration for the " + getPubsubName() + " pubsub";
}

@Override
public String getDescription() {
return "Manage and view Spinnaker configuration for the " + getPubsubName() + " pubsub";
}

protected AbstractNamedPubsubCommand() {
registerSubcommand(new PubsubEnableDisableCommandBuilder()
.setPubsubName(getPubsubName())
.setEnable(false)
.build()
);

registerSubcommand(new PubsubEnableDisableCommandBuilder()
.setPubsubName(getPubsubName())
.setEnable(true)
.build()
);
}

@Override
protected void executeThis() {
String currentDeployment = getCurrentDeployment();
String pubsubName = getPubsubName();
new OperationHandler<Pubsub>()
.setFailureMesssage("Failed to get pubsub " + pubsubName + ".")
.setSuccessMessage("Successfully got pubsub " + pubsubName + ".")
.setFormat(STRING)
.setUserFormatted(true)
.setOperation(Daemon.getPubsub(currentDeployment, pubsubName, !noValidate))
.get();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2017 Google, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/

package com.netflix.spinnaker.halyard.cli.command.v1.config.pubsubs;

import com.beust.jcommander.Parameters;
import com.netflix.spinnaker.halyard.cli.command.v1.config.AbstractConfigCommand;

@Parameters(separators = "=")
public abstract class AbstractPubsubCommand extends AbstractConfigCommand {
abstract protected String getPubsubName();
}
Loading