Skip to content

Commit

Permalink
feat(signalfx): Add support for configuring SignalFx canary service i…
Browse files Browse the repository at this point in the history
…ntegration (#1057)
  • Loading branch information
mayitbeegh authored and lwander committed Oct 12, 2018
1 parent 1676a66 commit 9a53b5b
Show file tree
Hide file tree
Showing 11 changed files with 480 additions and 0 deletions.
164 changes: 164 additions & 0 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@
* [**hal config canary datadog account list**](#hal-config-canary-datadog-account-list)
* [**hal config canary datadog disable**](#hal-config-canary-datadog-disable)
* [**hal config canary datadog enable**](#hal-config-canary-datadog-enable)
* [**hal config canary signalfx**](#hal-config-canary-signalfx)
* [**hal config canary signalfx account**](#hal-config-canary-signalfx-account)
* [**hal config canary signalfx account add**](#hal-config-canary-signalfx-account-add)
* [**hal config canary signalfx account delete**](#hal-config-canary-signalfx-account-delete)
* [**hal config canary signalfx account edit**](#hal-config-canary-signalfx-account-edit)
* [**hal config canary signalfx account get**](#hal-config-canary-signalfx-account-get)
* [**hal config canary signalfx account list**](#hal-config-canary-signalfx-account-list)
* [**hal config canary signalfx disable**](#hal-config-canary-signalfx-disable)
* [**hal config canary signalfx enable**](#hal-config-canary-signalfx-enable)
* [**hal config canary disable**](#hal-config-canary-disable)
* [**hal config canary edit**](#hal-config-canary-edit)
* [**hal config canary enable**](#hal-config-canary-enable)
Expand Down Expand Up @@ -1793,6 +1802,7 @@ hal config canary [parameters] [subcommands]
* `enable`: Set Spinnaker's canary analysis to enabled.
* `google`: Configure your canary analysis Google service integration settings for Spinnaker.
* `prometheus`: Configure your canary analysis Prometheus service integration settings for Spinnaker.
* `signalfx`: Configure your canary analysis SignalFx service integration settings for Spinnaker.

---
## hal config canary aws
Expand Down Expand Up @@ -2533,6 +2543,160 @@ hal config canary prometheus enable [parameters]
* `--no-validate`: (*Default*: `false`) Skip validation.


---
## hal config canary signalfx

Configure your canary analysis SignalFx service integration settings for Spinnaker.

#### Usage
```
hal config canary signalfx [parameters] [subcommands]
```

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

#### Subcommands
* `account`: Manage and view Spinnaker configuration for the SignalFx service integration's canary accounts.
* `disable`: Set Spinnaker's canary analysis SignalFx service integration to disabled.
* `enable`: Set Spinnaker's canary analysis SignalFx service integration to enabled.

---
## hal config canary signalfx account

Manage and view Spinnaker configuration for the SignalFx service integration's canary accounts.

#### Usage
```
hal config canary signalfx account ACCOUNT [parameters] [subcommands]
```

#### Parameters
`ACCOUNT`: The name of the canary account 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 a canary account to the SignalFx service integration.
* `delete`: Delete a specific SignalFx canary account by name.
* `edit`: Edit a canary account in the SignalFx service integration.
* `get`: Get the specified canary account details for the SignalFx service integration.
* `list`: List the canary account names for the SignalFx service integration.

---
## hal config canary signalfx account add

Add a canary account to the SignalFx service integration.

#### Usage
```
hal config canary signalfx account add ACCOUNT [parameters]
```

#### Parameters
`ACCOUNT`: The name of the canary account to operate on.
* `--access-token`: (*Required*) (*Sensitive data* - user will be prompted on standard input) The SignalFx access token.
* `--base-url`: (*Required*) The base URL to the SignalFx server.
* `--deployment`: If supplied, use this Halyard deployment. This will _not_ create a new deployment.
* `--no-validate`: (*Default*: `false`) Skip validation.


---
## hal config canary signalfx account delete

Delete a specific SignalFx canary account by name.

#### Usage
```
hal config canary signalfx account delete ACCOUNT [parameters]
```

#### Parameters
`ACCOUNT`: The name of the canary account 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 canary signalfx account edit

Edit a canary account in the SignalFx service integration.

#### Usage
```
hal config canary signalfx account edit ACCOUNT [parameters]
```

#### Parameters
`ACCOUNT`: The name of the canary account to operate on.
* `--access-token`: (*Sensitive data* - user will be prompted on standard input) The SignalFx access token.
* `--base-url`: The base URL to the SignalFx server.
* `--deployment`: If supplied, use this Halyard deployment. This will _not_ create a new deployment.
* `--no-validate`: (*Default*: `false`) Skip validation.


---
## hal config canary signalfx account get

Get the specified canary account details for the SignalFx service integration.

#### Usage
```
hal config canary signalfx account get ACCOUNT [parameters]
```

#### Parameters
`ACCOUNT`: The name of the canary account 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 canary signalfx account list

List the canary account names for the SignalFx service integration.

#### Usage
```
hal config canary signalfx account 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 canary signalfx disable

Set Spinnaker's canary analysis SignalFx service integration to disabled.

#### Usage
```
hal config canary signalfx 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 canary signalfx enable

Set Spinnaker's canary analysis SignalFx service integration to enabled.

#### Usage
```
hal config canary signalfx 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 ci

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.canary.datadog.CanaryDatadogCommand;
import com.netflix.spinnaker.halyard.cli.command.v1.config.canary.google.CanaryGoogleCommand;
import com.netflix.spinnaker.halyard.cli.command.v1.config.canary.prometheus.CanaryPrometheusCommand;
import com.netflix.spinnaker.halyard.cli.command.v1.config.canary.signalfx.CanarySignalfxCommand;
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 All @@ -47,6 +48,7 @@ public CanaryCommand() {
registerSubcommand(new CanaryGoogleCommand());
registerSubcommand(new CanaryPrometheusCommand());
registerSubcommand(new CanaryDatadogCommand());
registerSubcommand(new CanarySignalfxCommand());
registerSubcommand(new CanaryAwsCommand());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright (c) 2018 Nike, 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.canary.signalfx;

import com.beust.jcommander.Parameters;
import com.netflix.spinnaker.halyard.cli.command.v1.config.AbstractConfigCommand;
import com.netflix.spinnaker.halyard.cli.command.v1.config.canary.EnableDisableCanaryServiceIntegrationCommandBuilder;
import com.netflix.spinnaker.halyard.cli.command.v1.config.canary.signalfx.account.SignalfxCanaryAccountCommand;
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;
import com.netflix.spinnaker.halyard.config.model.v1.canary.Canary;
import com.netflix.spinnaker.halyard.config.model.v1.canary.signalfx.SignalfxCanaryServiceIntegration;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Parameters(separators = "=")
@Data
@EqualsAndHashCode(callSuper = false)
public class CanarySignalfxCommand extends AbstractConfigCommand {

String commandName = SignalfxCanaryServiceIntegration.NAME;

String shortDescription = "Configure your canary analysis SignalFx service integration settings for Spinnaker.";

String longDescription = shortDescription;

public CanarySignalfxCommand() {
registerSubcommand(new EnableDisableCanaryServiceIntegrationCommandBuilder().setName("Signalfx").setEnable(true).build());
registerSubcommand(new EnableDisableCanaryServiceIntegrationCommandBuilder().setName("Signalfx").setEnable(false).build());
registerSubcommand(new SignalfxCanaryAccountCommand());
}

@Override
protected void executeThis() {
String currentDeployment = getCurrentDeployment();

new OperationHandler<Canary>()
.setOperation(Daemon.getCanary(currentDeployment, !noValidate))
.setFailureMesssage("Failed to load canary settings.")
.setSuccessMessage("Configured canary settings: ")
.setFormat(AnsiFormatUtils.Format.STRING)
.setUserFormatted(true)
.get();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Copyright (c) 2018 Nike, 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.canary.signalfx.account;

import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import com.netflix.spinnaker.halyard.cli.command.v1.config.canary.account.AbstractAddCanaryAccountCommand;
import com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryAccount;
import com.netflix.spinnaker.halyard.config.model.v1.canary.Canary;
import com.netflix.spinnaker.halyard.config.model.v1.canary.signalfx.SignalfxCanaryAccount;

@Parameters(separators = "=")
public class SignalfxAddCanaryAccountCommand extends AbstractAddCanaryAccountCommand {

@Override
protected String getServiceIntegration() {
return "Signalfx";
}

@Parameter(
names = "--base-url",
required = true,
description = "The base URL to the SignalFx server."
)
private String baseUrl;

@Parameter(
names = "--access-token",
required = true,
password = true,
description = "The SignalFx access token."
)
private String accessToken;


@Override
protected AbstractCanaryAccount buildAccount(Canary canary, String accountName) {
SignalfxCanaryAccount account = (SignalfxCanaryAccount)new SignalfxCanaryAccount().setName(accountName);

account.setEndpoint(new SignalfxCanaryAccount.Endpoint().setBaseUrl(baseUrl))
.setAccessToken(accessToken);

return account;
}

@Override
protected AbstractCanaryAccount emptyAccount() {
return new SignalfxCanaryAccount();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2018 Nike, 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.canary.signalfx.account;

import com.beust.jcommander.Parameters;
import com.netflix.spinnaker.halyard.cli.command.v1.config.canary.account.AbstractCanaryAccountCommand;

/**
* Interact with the Signalfx service integration
*/
@Parameters(separators = "=")
public class SignalfxCanaryAccountCommand extends AbstractCanaryAccountCommand {

@Override
protected String getServiceIntegration() {
return "Signalfx";
}

public SignalfxCanaryAccountCommand() {
registerSubcommand(new SignalfxAddCanaryAccountCommand());
registerSubcommand(new SignalfxEditCanaryAccountCommand());
}
}

Loading

0 comments on commit 9a53b5b

Please sign in to comment.