#NEWLINE# def present( name , cidr_block , instance_tenancy = None , dns_support = None , dns_hostnames = None , tags = None , region = None , key = None , keyid = None , profile = None ) : #NEWLINE# #INDENT# '\n    Ensure VPC exists.\n\n    name\n        Name of the VPC.\n\n    cidr_block\n        The range of IPs in CIDR format, for example: 10.0.0.0/24. Block\n        size must be between /16 and /28 netmask.\n\n    instance_tenancy\n        Instances launched in this VPC will be ingle-tenant or dedicated\n        hardware.\n\n    dns_support\n        Indicates whether the DNS resolution is supported for the VPC.\n\n    dns_hostnames\n        Indicates whether the instances launched in the VPC get DNS hostnames.\n\n    tags\n        A list of tags.\n\n    region\n        Region to connect to.\n\n    key\n        Secret key to be used.\n\n    keyid\n        Access key to be used.\n\n    profile\n        A dict with region, key and keyid, or a pillar key (string) that\n        contains a dict with region, key and keyid.\n    ' #NEWLINE# ret = { #NEWLINE# #INDENT# 'name' : name , #NEWLINE# 'result' : True , #NEWLINE# 'comment' : '' , #NEWLINE# 'changes' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# r = __salt__ [ 'boto_vpc.exists' ] ( name = name , tags = tags , region = region , key = key , keyid = keyid , profile = profile ) #NEWLINE# if ( 'error' in r ) : #NEWLINE# #INDENT# ret [ 'result' ] = False #NEWLINE# ret [ 'comment' ] = 'Failed to create VPC: {0}.' . format ( r [ 'error' ] [ 'message' ] ) #NEWLINE# return ret #NEWLINE# #UNINDENT# if ( not r . get ( 'exists' ) ) : #NEWLINE# #INDENT# if __opts__ [ 'test' ] : #NEWLINE# #INDENT# ret [ 'comment' ] = 'VPC {0} is set to be created.' . format ( name ) #NEWLINE# ret [ 'result' ] = None #NEWLINE# return ret #NEWLINE# #UNINDENT# r = __salt__ [ 'boto_vpc.create' ] ( cidr_block , instance_tenancy = instance_tenancy , vpc_name = name , enable_dns_support = dns_support , enable_dns_hostnames = dns_hostnames , tags = tags , region = region , key = key , keyid = keyid , profile = profile ) #NEWLINE# if ( not r . get ( 'created' ) ) : #NEWLINE# #INDENT# ret [ 'result' ] = False #NEWLINE# ret [ 'comment' ] = 'Failed to create VPC: {0}.' . format ( r [ 'error' ] [ 'message' ] ) #NEWLINE# return ret #NEWLINE# #UNINDENT# _describe = __salt__ [ 'boto_vpc.describe' ] ( vpc_id = r [ 'id' ] , region = region , key = key , keyid = keyid , profile = ret ) #NEWLINE# ret [ 'changes' ] [ 'old' ] = { #NEWLINE# #INDENT# 'vpc' : None , #NEWLINE# #UNINDENT# } #NEWLINE# ret [ 'changes' ] [ 'new' ] = _describe #NEWLINE# ret [ 'comment' ] = 'VPC {0} created.' . format ( name ) #NEWLINE# return ret #NEWLINE# #UNINDENT# ret [ 'comment' ] = 'VPC present.' #NEWLINE# return ret