-
Notifications
You must be signed in to change notification settings - Fork 702
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(signalfx): Add support for configuring SignalFx canary service i…
…ntegration (#1057)
- Loading branch information
1 parent
1676a66
commit 9a53b5b
Showing
11 changed files
with
480 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...etflix/spinnaker/halyard/cli/command/v1/config/canary/signalfx/CanarySignalfxCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
...alyard/cli/command/v1/config/canary/signalfx/account/SignalfxAddCanaryAccountCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
...r/halyard/cli/command/v1/config/canary/signalfx/account/SignalfxCanaryAccountCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} | ||
|
Oops, something went wrong.