-
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(huaweicloud): add commands of bakery
- Loading branch information
1 parent
2b73faa
commit 697ebc8
Showing
13 changed files
with
734 additions
and
4 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
83 changes: 83 additions & 0 deletions
83
...r/halyard/cli/command/v1/config/providers/huaweicloud/HuaweiCloudAddBaseImageCommand.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,83 @@ | ||
/* | ||
* Copyright 2019 Huawei Technologies Co.,Ltd. | ||
* | ||
* 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.providers.huaweicloud; | ||
|
||
import com.beust.jcommander.Parameter; | ||
import com.beust.jcommander.Parameters; | ||
import com.netflix.spinnaker.halyard.cli.command.v1.config.providers.bakery.AbstractAddBaseImageCommand; | ||
import com.netflix.spinnaker.halyard.config.model.v1.node.BaseImage; | ||
import com.netflix.spinnaker.halyard.config.model.v1.providers.huaweicloud.HuaweiCloudBaseImage; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Parameters(separators = "=") | ||
public class HuaweiCloudAddBaseImageCommand extends AbstractAddBaseImageCommand { | ||
protected String getProviderName() { | ||
return "huaweicloud"; | ||
} | ||
|
||
@Parameter( | ||
names = "--region", | ||
required = true, | ||
description = HuaweiCloudCommandProperties.REGION_DESCRIPTION) | ||
private String region; | ||
|
||
@Parameter( | ||
names = "--instance-type", | ||
required = true, | ||
description = HuaweiCloudCommandProperties.INSTANCE_TYPE_DESCRIPTION) | ||
private String instanceType; | ||
|
||
@Parameter( | ||
names = "--source-image-id", | ||
required = true, | ||
description = HuaweiCloudCommandProperties.SOURCE_IMAGE_ID_DESCRIPTION) | ||
private String sourceImageId; | ||
|
||
@Parameter( | ||
names = "--ssh-user-name", | ||
required = true, | ||
description = HuaweiCloudCommandProperties.SSH_USER_NAME_DESCRIPTION) | ||
private String sshUserName; | ||
|
||
@Parameter( | ||
names = "--eip-type", | ||
required = true, | ||
description = HuaweiCloudCommandProperties.EIP_TYPE_DESCRIPTION) | ||
private String eipType; | ||
|
||
@Override | ||
protected BaseImage buildBaseImage(String baseImageId) { | ||
HuaweiCloudBaseImage baseImage = new HuaweiCloudBaseImage(); | ||
|
||
baseImage.setBaseImage(new HuaweiCloudBaseImage.HuaweiCloudImageSettings()); | ||
|
||
HuaweiCloudBaseImage.HuaweiCloudVirtualizationSettings virtualizationSettings = | ||
new HuaweiCloudBaseImage.HuaweiCloudVirtualizationSettings(); | ||
virtualizationSettings.setSourceImageId(sourceImageId); | ||
virtualizationSettings.setRegion(region); | ||
virtualizationSettings.setInstanceType(instanceType); | ||
virtualizationSettings.setSshUserName(sshUserName); | ||
virtualizationSettings.setEipType(eipType); | ||
|
||
List<HuaweiCloudBaseImage.HuaweiCloudVirtualizationSettings> vsList = new ArrayList<>(); | ||
vsList.add(virtualizationSettings); | ||
|
||
baseImage.setVirtualizationSettings(vsList); | ||
return baseImage; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...innaker/halyard/cli/command/v1/config/providers/huaweicloud/HuaweiCloudBakeryCommand.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,33 @@ | ||
/* | ||
* Copyright 2019 Huawei Technologies Co.,Ltd. | ||
* | ||
* 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.providers.huaweicloud; | ||
|
||
import com.beust.jcommander.Parameters; | ||
import com.netflix.spinnaker.halyard.cli.command.v1.config.providers.AbstractBakeryCommand; | ||
|
||
@Parameters(separators = "=") | ||
public class HuaweiCloudBakeryCommand extends AbstractBakeryCommand { | ||
protected String getProviderName() { | ||
return "huaweicloud"; | ||
} | ||
|
||
public HuaweiCloudBakeryCommand() { | ||
super(); | ||
registerSubcommand(new HuaweiCloudEditBakeryDefaultsCommand()); | ||
registerSubcommand(new HuaweiCloudBaseImageCommand()); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...aker/halyard/cli/command/v1/config/providers/huaweicloud/HuaweiCloudBaseImageCommand.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,33 @@ | ||
/* | ||
* Copyright 2019 Huawei Technologies Co.,Ltd. | ||
* | ||
* 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.providers.huaweicloud; | ||
|
||
import com.beust.jcommander.Parameters; | ||
import com.netflix.spinnaker.halyard.cli.command.v1.config.providers.bakery.AbstractBaseImageCommand; | ||
|
||
@Parameters(separators = "=") | ||
public class HuaweiCloudBaseImageCommand extends AbstractBaseImageCommand { | ||
protected String getProviderName() { | ||
return "huaweicloud"; | ||
} | ||
|
||
public HuaweiCloudBaseImageCommand() { | ||
super(); | ||
registerSubcommand(new HuaweiCloudAddBaseImageCommand()); | ||
registerSubcommand(new HuaweiCloudEditBaseImageCommand()); | ||
} | ||
} |
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
Oops, something went wrong.