Skip to content

Commit

Permalink
Merge branch 'opsworks-elb' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
toastdriven committed May 15, 2013
2 parents b91f991 + ecda872 commit 23aaef5
Showing 1 changed file with 108 additions and 16 deletions.
124 changes: 108 additions & 16 deletions boto/opsworks/layer1.py
Expand Up @@ -57,13 +57,33 @@ def __init__(self, **kwargs):
def _required_auth_capability(self):
return ['hmac-v4']

def attach_elastic_load_balancer(self, elastic_load_balancer_name,
layer_id):
"""
:type elastic_load_balancer_name: string
:param elastic_load_balancer_name:
:type layer_id: string
:param layer_id:
"""
params = {
'ElasticLoadBalancerName': elastic_load_balancer_name,
'LayerId': layer_id,
}
return self.make_request(action='AttachElasticLoadBalancer',
body=json.dumps(params))

def clone_stack(self, source_stack_id, service_role_arn, name=None,
region=None, attributes=None,
default_instance_profile_arn=None, default_os=None,
hostname_theme=None, default_availability_zone=None,
custom_json=None, use_custom_cookbooks=None,
custom_cookbooks_source=None, default_ssh_key_name=None,
clone_permissions=None, clone_app_ids=None):
clone_permissions=None, clone_app_ids=None,
default_root_device_type=None):
"""
Creates a clone of a specified stack.
Expand All @@ -74,7 +94,7 @@ def clone_stack(self, source_stack_id, service_role_arn, name=None,
:param name: The cloned stack name.
:type region: string
:param region: The cloned stack AWS region, such as "us-west-2". For
:param region: The cloned stack AWS region, such as "us-east-1". For
more information about AWS regions, see `Regions and Endpoints`_
:type attributes: map
Expand Down Expand Up @@ -153,6 +173,9 @@ def clone_stack(self, source_stack_id, service_role_arn, name=None,
:param clone_app_ids: A list of source stack app IDs to be included in
the cloned stack.
:type default_root_device_type: string
:param default_root_device_type:
"""
params = {
'SourceStackId': source_stack_id,
Expand Down Expand Up @@ -184,18 +207,23 @@ def clone_stack(self, source_stack_id, service_role_arn, name=None,
params['ClonePermissions'] = clone_permissions
if clone_app_ids is not None:
params['CloneAppIds'] = clone_app_ids
if default_root_device_type is not None:
params['DefaultRootDeviceType'] = default_root_device_type
return self.make_request(action='CloneStack',
body=json.dumps(params))

def create_app(self, stack_id, name, type, description=None,
app_source=None, domains=None, enable_ssl=None,
ssl_configuration=None, attributes=None):
def create_app(self, stack_id, name, type, shortname=None,
description=None, app_source=None, domains=None,
enable_ssl=None, ssl_configuration=None, attributes=None):
"""
Creates an app for a specified stack.
:type stack_id: string
:param stack_id: The stack ID.
:type shortname: string
:param shortname:
:type name: string
:param name: The app name.
Expand Down Expand Up @@ -228,6 +256,8 @@ def create_app(self, stack_id, name, type, description=None,
"""
params = {'StackId': stack_id, 'Name': name, 'Type': type, }
if shortname is not None:
params['Shortname'] = shortname
if description is not None:
params['Description'] = description
if app_source is not None:
Expand Down Expand Up @@ -294,7 +324,8 @@ def create_deployment(self, stack_id, command, app_id=None,

def create_instance(self, stack_id, layer_ids, instance_type,
auto_scaling_type=None, hostname=None, os=None,
ssh_key_name=None, availability_zone=None):
ssh_key_name=None, availability_zone=None,
architecture=None, root_device_type=None):
"""
Creates an instance in a specified stack.
Expand Down Expand Up @@ -347,6 +378,12 @@ def create_instance(self, stack_id, layer_ids, instance_type,
:param availability_zone: The instance Availability Zone. For more
information, see `Regions and Endpoints`_.
:type architecture: string
:param architecture:
:type root_device_type: string
:param root_device_type:
"""
params = {
'StackId': stack_id,
Expand All @@ -363,6 +400,10 @@ def create_instance(self, stack_id, layer_ids, instance_type,
params['SshKeyName'] = ssh_key_name
if availability_zone is not None:
params['AvailabilityZone'] = availability_zone
if architecture is not None:
params['Architecture'] = architecture
if root_device_type is not None:
params['RootDeviceType'] = root_device_type
return self.make_request(action='CreateInstance',
body=json.dumps(params))

Expand Down Expand Up @@ -455,15 +496,16 @@ def create_stack(self, name, region, service_role_arn,
default_os=None, hostname_theme=None,
default_availability_zone=None, custom_json=None,
use_custom_cookbooks=None, custom_cookbooks_source=None,
default_ssh_key_name=None):
default_ssh_key_name=None,
default_root_device_type=None):
"""
Creates a new stack.
:type name: string
:param name: The stack name.
:type region: string
:param region: The stack AWS region, such as "us-west-2". For more
:param region: The stack AWS region, such as "us-east-1". For more
information about Amazon regions, see `Regions and Endpoints`_.
:type attributes: map
Expand Down Expand Up @@ -531,6 +573,9 @@ def create_stack(self, name, region, service_role_arn,
:param default_ssh_key_name: A default SSH key for the stack instances.
You can override this value when you create or update an instance.
:type default_root_device_type: string
:param default_root_device_type:
"""
params = {
'Name': name,
Expand All @@ -554,6 +599,8 @@ def create_stack(self, name, region, service_role_arn,
params['CustomCookbooksSource'] = custom_cookbooks_source
if default_ssh_key_name is not None:
params['DefaultSshKeyName'] = default_ssh_key_name
if default_root_device_type is not None:
params['DefaultRootDeviceType'] = default_root_device_type
return self.make_request(action='CreateStack',
body=json.dumps(params))

Expand Down Expand Up @@ -744,7 +791,26 @@ def describe_elastic_ips(self, instance_id=None, ips=None):
return self.make_request(action='DescribeElasticIps',
body=json.dumps(params))

def describe_instances(self, stack_id=None, layer_id=None, app_id=None,
def describe_elastic_load_balancers(self, stack_id=None, layer_ids=None):
"""
:type stack_id: string
:param stack_id:
:type layer_ids: list
:param layer_ids:
"""
params = {}
if stack_id is not None:
params['StackId'] = stack_id
if layer_ids is not None:
params['LayerIds'] = layer_ids
return self.make_request(action='DescribeElasticLoadBalancers',
body=json.dumps(params))

def describe_instances(self, stack_id=None, layer_id=None,
instance_ids=None):
"""
Requests a description of a set of instances associated with a
Expand All @@ -756,9 +822,6 @@ def describe_instances(self, stack_id=None, layer_id=None, app_id=None,
:type layer_id: string
:param layer_id: A layer ID.
:type app_id: string
:param app_id: An app ID.
:type instance_ids: list
:param instance_ids: An array of instance IDs to be described.
Expand All @@ -768,8 +831,6 @@ def describe_instances(self, stack_id=None, layer_id=None, app_id=None,
params['StackId'] = stack_id
if layer_id is not None:
params['LayerId'] = layer_id
if app_id is not None:
params['AppId'] = app_id
if instance_ids is not None:
params['InstanceIds'] = instance_ids
return self.make_request(action='DescribeInstances',
Expand Down Expand Up @@ -935,6 +996,25 @@ def describe_volumes(self, instance_id=None, raid_array_id=None,
return self.make_request(action='DescribeVolumes',
body=json.dumps(params))

def detach_elastic_load_balancer(self, elastic_load_balancer_name,
layer_id):
"""
:type elastic_load_balancer_name: string
:param elastic_load_balancer_name:
:type layer_id: string
:param layer_id:
"""
params = {
'ElasticLoadBalancerName': elastic_load_balancer_name,
'LayerId': layer_id,
}
return self.make_request(action='DetachElasticLoadBalancer',
body=json.dumps(params))

def get_hostname_suggestion(self, layer_id):
"""
Gets a generated hostname for the specified layer, based on
Expand Down Expand Up @@ -1159,7 +1239,8 @@ def update_app(self, app_id, name=None, description=None, type=None,

def update_instance(self, instance_id, layer_ids=None,
instance_type=None, auto_scaling_type=None,
hostname=None, os=None, ssh_key_name=None):
hostname=None, os=None, ssh_key_name=None,
architecture=None):
"""
Updates a specified instance.
Expand Down Expand Up @@ -1205,6 +1286,9 @@ def update_instance(self, instance_id, layer_ids=None,
:type ssh_key_name: string
:param ssh_key_name: The instance SSH key name.
:type architecture: string
:param architecture:
"""
params = {'InstanceId': instance_id, }
if layer_ids is not None:
Expand All @@ -1219,6 +1303,8 @@ def update_instance(self, instance_id, layer_ids=None,
params['Os'] = os
if ssh_key_name is not None:
params['SshKeyName'] = ssh_key_name
if architecture is not None:
params['Architecture'] = architecture
return self.make_request(action='UpdateInstance',
body=json.dumps(params))

Expand Down Expand Up @@ -1306,7 +1392,8 @@ def update_stack(self, stack_id, name=None, attributes=None,
default_instance_profile_arn=None, default_os=None,
hostname_theme=None, default_availability_zone=None,
custom_json=None, use_custom_cookbooks=None,
custom_cookbooks_source=None, default_ssh_key_name=None):
custom_cookbooks_source=None, default_ssh_key_name=None,
default_root_device_type=None):
"""
Updates a specified stack.
Expand Down Expand Up @@ -1381,6 +1468,9 @@ def update_stack(self, stack_id, name=None, attributes=None,
:param default_ssh_key_name: A default SSH key for the stack instances.
You can override this value when you create or update an instance.
:type default_root_device_type: string
:param default_root_device_type:
"""
params = {'StackId': stack_id, }
if name is not None:
Expand All @@ -1405,6 +1495,8 @@ def update_stack(self, stack_id, name=None, attributes=None,
params['CustomCookbooksSource'] = custom_cookbooks_source
if default_ssh_key_name is not None:
params['DefaultSshKeyName'] = default_ssh_key_name
if default_root_device_type is not None:
params['DefaultRootDeviceType'] = default_root_device_type
return self.make_request(action='UpdateStack',
body=json.dumps(params))

Expand Down

0 comments on commit 23aaef5

Please sign in to comment.