Skip to content

Commit

Permalink
Added CreateServerGroup AO. (#2338)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkirillov authored and robzienert committed Feb 1, 2018
1 parent 7c244bf commit a89f54d
Show file tree
Hide file tree
Showing 8 changed files with 914 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
/*
* Copyright 2018 Lookout, 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.clouddriver.ecs.deploy.converters;

import com.netflix.spinnaker.clouddriver.deploy.DeployAtomicOperation;
import com.netflix.spinnaker.clouddriver.ecs.EcsOperation;
import com.netflix.spinnaker.clouddriver.ecs.deploy.description.BasicEcsDeployDescription;
import com.netflix.spinnaker.clouddriver.ecs.deploy.description.CreateServerGroupDescription;
import com.netflix.spinnaker.clouddriver.ecs.deploy.ops.CreateServerGroupAtomicOperation;
import com.netflix.spinnaker.clouddriver.orchestration.AtomicOperation;
import com.netflix.spinnaker.clouddriver.orchestration.AtomicOperations;
import com.netflix.spinnaker.clouddriver.security.AbstractAtomicOperationsCredentialsSupport;
Expand All @@ -11,17 +27,17 @@
import java.util.Map;

@EcsOperation(AtomicOperations.CREATE_SERVER_GROUP)
@Component("basicEcsDeployDescription")
@Component("ecsCreateServerGroup")
public class EcsCreateServerGroupAtomicOperationConverter extends AbstractAtomicOperationsCredentialsSupport {

@Override
public AtomicOperation convertOperation(Map input) {
return new DeployAtomicOperation(convertDescription(input));
return new CreateServerGroupAtomicOperation(convertDescription(input));
}

@Override
public BasicEcsDeployDescription convertDescription(Map input) {
BasicEcsDeployDescription converted = getObjectMapper().convertValue(input, BasicEcsDeployDescription.class);
public CreateServerGroupDescription convertDescription(Map input) {
CreateServerGroupDescription converted = getObjectMapper().convertValue(input, CreateServerGroupDescription.class);
converted.setCredentials(getCredentialsObject(input.get("credentials").toString()));

return converted;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright 2018 Lookout, 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.clouddriver.ecs.deploy.description;

import com.amazonaws.services.cloudwatch.model.MetricAlarm;
import com.amazonaws.services.ecs.model.PlacementStrategy;
import com.netflix.spinnaker.clouddriver.model.ServerGroup;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;
import java.util.Map;

@Data
@EqualsAndHashCode(callSuper = false)
public class CreateServerGroupDescription extends AbstractECSDescription {
String ecsClusterName;
String iamRole;
Integer containerPort;
String targetGroup;
List<String> securityGroups;

String portProtocol;

Integer computeUnits;
Integer reservedMemory;

String dockerImageAddress;

ServerGroup.Capacity capacity;

Map<String, List<String>> availabilityZones;

List<MetricAlarm> autoscalingPolicies;
List<PlacementStrategy> placementStrategySequence;
}
Loading

0 comments on commit a89f54d

Please sign in to comment.