Skip to content

Commit

Permalink
feat(alibabacloud): add alibaba cloud provider's model definition (#3852
Browse files Browse the repository at this point in the history
)
  • Loading branch information
xiaozhu36 authored and robzienert committed Jul 18, 2019
1 parent 38da77c commit fb21d90
Show file tree
Hide file tree
Showing 19 changed files with 1,096 additions and 0 deletions.
5 changes: 5 additions & 0 deletions clouddriver-alicloud/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Alibaba Cloud Clouddriver

The clouddriver-alicloud module aims to deploy an application on Alibaba Cloud.

It is a work in progress
28 changes: 28 additions & 0 deletions clouddriver-alicloud/clouddriver-alicloud.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
dependencies {
implementation project(":cats:cats-core")
implementation project(":clouddriver-core")
implementation project(":clouddriver-eureka")
implementation project(":clouddriver-security")

compileOnly "org.projectlombok:lombok"
annotationProcessor "org.projectlombok:lombok"
testAnnotationProcessor "org.projectlombok:lombok"

implementation "com.netflix.spinnaker.kork:kork-core"
implementation "com.netflix.spinnaker.kork:kork-exceptions"
implementation "com.netflix.spinnaker.kork:kork-security"
implementation "com.netflix.frigga:frigga"
implementation "org.apache.httpcomponents:httpclient"
implementation "org.apache.httpcomponents:httpcore"
implementation "com.github.ben-manes.caffeine:guava"
implementation "com.netflix.spinnaker.moniker:moniker"

implementation 'com.aestasit.infrastructure.sshoogr:sshoogr:0.9.25'
implementation 'com.jcraft:jsch.agentproxy.jsch:0.0.9'
implementation 'com.jcraft:jsch.agentproxy.connector-factory:0.0.9'
implementation 'com.aliyun:aliyun-java-sdk-core:4.4.2'
implementation 'com.aliyun:aliyun-java-sdk-slb:3.2.9'
implementation 'com.aliyun:aliyun-java-sdk-vpc:3.0.6'
implementation 'com.aliyun:aliyun-java-sdk-ecs:4.16.10'
implementation 'com.aliyun:aliyun-java-sdk-ess:2.3.0'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2019 Alibaba Group.
*
* 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.clouddriver.alicloud;

/**
* @author: luoguan
* @create: 2019-05-16 09:49
*/
public class AliCloudConfigurationProperties {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright 2019 Alibaba Group.
*
* 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.clouddriver.alicloud;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface AliCloudOperation {
String value();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright 2019 Alibaba Group.
*
* 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.clouddriver.alicloud;

import com.netflix.spinnaker.clouddriver.core.CloudProvider;
import java.lang.annotation.Annotation;
import org.springframework.stereotype.Component;

@Component
public class AliCloudProvider implements CloudProvider {
public static final String ID = "alicloud";

final String id = ID;

final String displayName = "Alicloud";

final Class<? extends Annotation> operationAnnotationType = AliCloudOperation.class;

@Override
public String getId() {
return id;
}

@Override
public String getDisplayName() {
return displayName;
}

@Override
public Class<? extends Annotation> getOperationAnnotationType() {
return operationAnnotationType;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Copyright 2019 Alibaba Group.
*
* 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.clouddriver.alicloud.model;

import com.netflix.spinnaker.clouddriver.model.Cluster;
import java.util.Set;

/**
* @author: luoguan
* @create: 2019-06-18 16:35
*/
public class AliCloudCluster implements Cluster {

private String name;
private String type;
private String accountName;
private Set<AliCloudServerGroup> serverGroups;
private Set<AliCloudLoadBalancer> loadBalancers;

public AliCloudCluster(
String name,
String type,
String accountName,
Set<AliCloudServerGroup> serverGroups,
Set<AliCloudLoadBalancer> loadBalancers) {
this.name = name;
this.type = type;
this.accountName = accountName;
this.serverGroups = serverGroups;
this.loadBalancers = loadBalancers;
}

@Override
public String getName() {
return name;
}

@Override
public String getType() {
return type;
}

@Override
public String getAccountName() {
return accountName;
}

@Override
public Set<AliCloudServerGroup> getServerGroups() {
return serverGroups;
}

@Override
public Set<AliCloudLoadBalancer> getLoadBalancers() {
return loadBalancers;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* Copyright 2019 Alibaba Group.
*
* 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.clouddriver.alicloud.model;

import com.netflix.spinnaker.clouddriver.model.HealthState;
import com.netflix.spinnaker.clouddriver.model.Instance;
import java.util.List;
import java.util.Map;

/**
* @author: luoguan
* @create: 2019-06-18 16:51
*/
public class AliCloudInstance implements Instance {

private String name;
private Long launchTime;
private String zone;
private String providerType;
private String cloudProvider;
private HealthState healthState;
private List<Map<String, Object>> health;

public AliCloudInstance(
String name,
Long launchTime,
String zone,
String providerType,
String cloudProvider,
HealthState healthState,
List<Map<String, Object>> health) {
this.name = name;
this.launchTime = launchTime;
this.zone = zone;
this.providerType = providerType;
this.cloudProvider = cloudProvider;
this.healthState = healthState;
this.health = health;
}

@Override
public String getName() {
return name;
}

@Override
public Long getLaunchTime() {
return launchTime;
}

@Override
public String getZone() {
return zone;
}

@Override
public String getProviderType() {
return providerType;
}

@Override
public String getCloudProvider() {
return cloudProvider;
}

@Override
public HealthState getHealthState() {
return healthState;
}

@Override
public List<Map<String, Object>> getHealth() {
return health;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright 2019 Alibaba Group.
*
* 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.clouddriver.alicloud.model;

import com.netflix.spinnaker.clouddriver.alicloud.AliCloudProvider;
import com.netflix.spinnaker.clouddriver.model.KeyPair;

/**
* @author: luoguan
* @create: 2019-06-11 15:23
*/
public class AliCloudKeyPair implements KeyPair {

String account;
String region;
String keyName;
String keyFingerprint;
String cloudProvider = AliCloudProvider.ID;

public AliCloudKeyPair(String account, String region, String keyName, String keyFingerprint) {
this.account = account;
this.region = region;
this.keyName = keyName;
this.keyFingerprint = keyFingerprint;
}

@Override
public String getKeyName() {
return keyName;
}

@Override
public String getKeyFingerprint() {
return keyFingerprint;
}

public String getAccount() {
return account;
}

public String getRegion() {
return region;
}

public String getCloudProvider() {
return cloudProvider;
}
}
Loading

0 comments on commit fb21d90

Please sign in to comment.