Given a name, describes CloudFront stacks and returns dict of the stack Outputs
        , else returns an empty dict.
436005
def stack_outputs(self, name):
        
        try:
            stack = self.cf_client.describe_stacks(StackName=name)['Stacks'][0]
            return {x['OutputKey']: x['OutputValue'] for x in stack['Outputs']}
        except botocore.client.ClientError:
            return {}
997235
def cloudfront_domain_name(self, lookup, default=None):
    
    # list_distributions returns at most 100 distributions per request
    list_limit = "100"
    distributions = EFAwsResolver.__CLIENTS["cloudfront"].list_distributions(MaxItems=list_limit)["DistributionList"]
    # Return if the account has no Distributions
    if not distributions.has_key("Items"):
      return default
    while True:
      for distribution in distributions["Items"]:
        if lookup in distribution["Aliases"]["Items"]:
          return distribution["DomainName"]
      if distributions["IsTruncated"]:
        distributions = EFAwsResolver.__CLIENTS["cloudfront"].list_distributions(
          MaxItems=list_limit, Marker=distributions["NextMarker"])["DistributionList"]
      else:
        return default
1081125
def asdict(self, name, _type=None, _set=False):
        

        if _type is None:
            _type = lambda t: t

        dict_str = self.pop(name, None)
        if not dict_str:
            return {}

        _dict = {}
        for item in split_strip(dict_str):
            key, _, val = item.partition(':')
            val = _type(val)
            if key in _dict:
                if isinstance(_dict[key], list):
                    _dict[key].append(val)
                else:
                    _dict[key] = [_dict[key], val]
            else:
                _dict[key] = val

        if _set:
            self[name] = _dict

        return _dict
1296995
def get(self, name, return_json=False, quiet=False):
    '''
    '''
    from spython.utils import check_install
    check_install()

    # Ensure compatible for singularity prior to 3.0, and after 3.0
    subgroup = "instance.list"

    if 'version 3' in self.version():
        subgroup = ["instance", "list"]

    cmd = self._init_command(subgroup)

    cmd.append(name)
    output = run_command(cmd, quiet=True)

    # Success, we have instances

    if output['return_code'] == 0:

        # Only print the table if we are returning json
        if quiet is False:
            print(''.join(output['message']))

        # Prepare json result from table

        header = ['daemon_name','pid','container_image']
        instances = parse_table(output['message'][0], header)

        # Does the user want instance objects instead?
        listing = []
        if return_json is False:
            for i in instances:
                new_instance = Instance(pid=i['pid'],
                                        name=i['daemon_name'],
                                        image=i['container_image'],
                                        start=False)

                listing.append(new_instance)
            instances = listing

    # Couldn't get UID

    elif output['return_code'] == 255:
        bot.error("Couldn't get UID")
        
    # Return code of 0
    else:
        bot.info('No instances found.')

    # If we are given a name, return just one
    if name is not None and len(instances) == 1:
        instances = instances[0]

    return instances
1194023
def dns_name(self):
        
        for scope in ['public', 'local-cloud']:
            addresses = self.safe_data['addresses'] or []
            addresses = [address for address in addresses
                         if address['scope'] == scope]
            if addresses:
                return addresses[0]['value']
        return None
510552
def info(awsclient, config, format=None):
    
    if format is None:
        format = 'tabular'
    stack_name = _get_stack_name(config)
    client_cfn = awsclient.get_client('cloudformation')

    resources = all_pages(
        client_cfn.list_stack_resources,
        {'StackName': stack_name},
        lambda x: [(r['ResourceType'], r['LogicalResourceId'], r['ResourceStatus'])
            for r in x['StackResourceSummaries']]
    )

    infos = {
        'stack_output': _get_stack_outputs(client_cfn, stack_name),
        'stack_state': _get_stack_state(client_cfn, stack_name),
        'resources': resources
    }
    if format == 'json':
        print(json.dumps(infos))
    elif format == 'tabular':
        print('stack output:')
        print(tabulate(infos['stack_output'], tablefmt='fancy_grid'))
        print('\nstack_state: %s' % infos['stack_state'])
        print('\nresources:')
        print(tabulate(infos['resources'], tablefmt='fancy_grid'))
52708
def export(name: str, value: Any):
    
    stack = get_root_resource()
    if stack is not None:
        stack.output(name, value)
1372027
def get_type_data(name):
    
    name = name.upper()
    try:
        return {
            'authority': 'okapia.net',
            'namespace': 'string match types',
            'identifier': name,
            'domain': 'String Match Types',
            'display_name': STRING_MATCH_TYPES[name] + ' String Match Type',
            'display_label': STRING_MATCH_TYPES[name],
            'description': ('The string match type for the ' +
                            STRING_MATCH_TYPES[name])
        }
    except KeyError:
        raise NotFound('String Type: ' + name)
361107
def exists(name, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    try:
        # Returns an object if stack exists else an exception
        exists = conn.describe_stacks(name)
        log.debug('Stack %s exists.', name)
        return True
    except BotoServerError as e:
        log.debug('boto_cfn.exists raised an exception', exc_info=True)
        return False
907401
def stack_in_progress?(stack_name)
      return true if !stack_exists?(stack_name)

      # Assumes stack exists
      resp = cfn.describe_stacks(stack_name: stack_name)
      status = resp.stacks[0].stack_status
      if status =~ /_IN_PROGRESS$/
        puts "The '#{stack_name}' stack status is #{status}. " \
             "Please wait until the stack is ready and try again.".color(:red)
        exit 0
      elsif resp.stacks[0].outputs.empty? && status != 'ROLLBACK_COMPLETE'
        # This Happens when the miminal stack fails at the very beginning.
        # There is no s3 bucket at all.  User should delete the stack.
        puts "The minimal stack failed to create. Please delete the stack first and try again. " \
        "You can delete the CloudFormation stack or use the `jets delete` command"
        exit 0
      else
        true
      end
    end
718890
def clouds(self, id=None, name=None, provider=None, search=None):
        
        if self._clouds is None:
            self._clouds = {}
            self._list_clouds()

        if id:
            return [self._clouds[cloud_id] for cloud_id in self._clouds.keys()
                    if id == self._clouds[cloud_id].id]
        elif name:
            return [self._clouds[cloud_id] for cloud_id in self._clouds.keys()
                    if name == self._clouds[cloud_id].title]
        elif provider:
            return [self._clouds[cloud_id] for cloud_id in self._clouds.keys()
                    if provider == self._clouds[cloud_id].provider]
        elif search:
            return [self._clouds[cloud_id] for cloud_id in self._clouds.keys()
                    if search in self._clouds[cloud_id].title
                    or search in self._clouds[cloud_id].id
                    or search in self._clouds[cloud_id].provider]
        else:
            return [self._clouds[cloud_id] for cloud_id in self._clouds.keys()]
997749
def get_stacks(self):
        
        if not hasattr(self, "_stacks"):
            stacks = []
            definitions = self._get_stack_definitions()
            for stack_def in definitions:
                stack = Stack(
                    definition=stack_def,
                    context=self,
                    mappings=self.mappings,
                    force=stack_def.name in self.force_stacks,
                    locked=stack_def.locked,
                    enabled=stack_def.enabled,
                    protected=stack_def.protected,
                )
                stacks.append(stack)
            self._stacks = stacks
        return self._stacks
719222
def listdir(self, name):
        
        return [], [obj.filename for obj in cloudstorage.listbucket(self.path(name))]
603487
def show_instance(name, call=None):
    '''
    
    '''
    if call != 'action':
        raise SaltCloudSystemExit(
            'The show_instance action must be called with -a or --action.'
        )

    nodes = list_nodes_full()
    # Find under which cloud service the name is listed, if any
    if name not in nodes:
        return {}
    __utils__['cloud.cache_node'](nodes[name], __active_provider_name__, __opts__)
    return nodes[name]
1252346
def List(self, name, initial=None):
        
        return types.List(name, self.api, initial=initial)
419934
def parse_stack(self, global_params, region, stack):
        
        stack['id'] = stack.pop('StackId')
        stack['name'] = stack.pop('StackName')
        stack_policy = api_clients[region].get_stack_policy(StackName = stack['name'])
        if 'StackPolicyBody' in stack_policy:
            stack['policy'] = json.loads(stack_policy['StackPolicyBody'])
        self.stacks[stack['name']] = stack
200388
def show_namespace(name, **kwargs):
    '''
    
    '''
    cfg = _setup_conn(**kwargs)
    try:
        api_instance = kubernetes.client.CoreV1Api()
        api_response = api_instance.read_namespace(name)

        return api_response.to_dict()
    except (ApiException, HTTPError) as exc:
        if isinstance(exc, ApiException) and exc.status == 404:
            return None
        else:
            log.exception(
                'Exception when calling '
                'CoreV1Api->read_namespace'
            )
            raise CommandExecutionError(exc)
    finally:
        _cleanup(**cfg)