Returns details about a specific SNS topic, specified by name or ARN.

    CLI example::

        salt my_favorite_client boto3_sns.describe_topic a_sns_topic_of_my_choice
773056
def describe_topic(name, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    topics = list_topics(region=region, key=key, keyid=keyid, profile=profile)
    ret = {}
    for topic, arn in topics.items():
        if name in (topic, arn):
            ret = {'TopicArn': arn}
            ret['Attributes'] = get_topic_attributes(arn, region=region, key=key, keyid=keyid,
                    profile=profile)
            ret['Subscriptions'] = list_subscriptions_by_topic(arn, region=region, key=key,
                    keyid=keyid, profile=profile)
            # Grab extended attributes for the above subscriptions
            for sub in range(len(ret['Subscriptions'])):
                sub_arn = ret['Subscriptions'][sub]['SubscriptionArn']
                if not sub_arn.startswith('arn:aws:sns:'):
                    # Sometimes a sub is in e.g. PendingAccept or other
                    # wierd states and doesn't have an ARN yet
                    log.debug('Subscription with invalid ARN %s skipped...', sub_arn)
                    continue
                deets = get_subscription_attributes(SubscriptionArn=sub_arn, region=region,
                        key=key, keyid=keyid, profile=profile)
                ret['Subscriptions'][sub].update(deets)
    return ret
561411
def topic=(new_topic)
      if new_topic.size > @bot.irc.isupport["TOPICLEN"] && @bot.strict?
        raise Exceptions::TopicTooLong, new_topic
      end

      @bot.irc.send "TOPIC #@name :#{new_topic}"
    end
597779
def exists(name, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    topics = get_all_topics(region=region, key=key, keyid=keyid,
                            profile=profile)
    if name.startswith('arn:aws:sns:'):
        return name in list(topics.values())
    else:
        return name in list(topics.keys())
600689
def get_comment_brok(self, host_name, service_name=''):
        
        data = self.serialize()
        data['host'] = host_name
        if service_name:
            data['service'] = service_name

        return Brok({'type': 'comment', 'data': data})
692227
def _find_apis_by_name(name, description=None,
                       region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    try:
        conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
        apis = _multi_call(conn.get_rest_apis, 'items')
        if name:
            apis = _filter_apis(name, apis)
        if description is not None:
            apis = _filter_apis_desc(description, apis)
        return {'restapi': [_convert_datetime_str(api) for api in apis]}
    except ClientError as e:
        return {'error': __utils__['boto3.get_error'](e)}
264845
def create_topic(Name, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    try:
        ret = conn.create_topic(Name=Name)
        log.info('SNS topic %s created with ARN %s', Name, ret['TopicArn'])
        return ret['TopicArn']
    except botocore.exceptions.ClientError as e:
        log.error('Failed to create SNS topic %s: %s', Name, e)
        return None
    except KeyError:
        log.error('Failed to create SNS topic %s', Name)
        return None
762284
def describe_parameters(name, Source=None, MaxRecords=None, Marker=None,
                        region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    res = __salt__['boto_rds.parameter_group_exists'](name, tags=None,
                                                      region=region, key=key,
                                                      keyid=keyid,
                                                      profile=profile)
    if not res.get('exists'):
        return {'result': False,
                'message': 'Parameter group {0} does not exist'.format(name)}

    try:
        conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
        if not conn:
            return {'result': False,
                    'message': 'Could not establish a connection to RDS'}

        kwargs = {}
        kwargs.update({'DBParameterGroupName': name})
        for key in ('Marker', 'Source'):
            if locals()[key] is not None:
                kwargs[key] = str(locals()[key])  # future lint: disable=blacklisted-function

        if locals()['MaxRecords'] is not None:
            kwargs['MaxRecords'] = int(locals()['MaxRecords'])

        pag = conn.get_paginator('describe_db_parameters')
        pit = pag.paginate(**kwargs)

        keys = ['ParameterName', 'ParameterValue', 'Description',
                'Source', 'ApplyType', 'DataType', 'AllowedValues',
                'IsModifieable', 'MinimumEngineVersion', 'ApplyMethod']

        parameters = odict.OrderedDict()
        ret = {'result':  True}

        for p in pit:
            for result in p['Parameters']:
                data = odict.OrderedDict()
                for k in keys:
                    data[k] = result.get(k)

                parameters[result.get('ParameterName')] = data

        ret['parameters'] = parameters
        return ret
    except ClientError as e:
        return {'error': __utils__['boto3.get_error'](e)}
1110785
def discover_details(self):
        '''
        
        '''
        if (self.root_node == None):
            return

        if (self.verbose > 0):
            print('\nCollecting node details...')

        ni = 0
        for n in self.nodes:
            ni = ni + 1

            indicator = '+'
            if (n.snmpobj.success == 0):
                indicator = '!'

            if (self.verbose > 0):
                sys.stdout.write('[%i/%i]%s %s (%s)' % (ni, len(self.nodes), indicator, n.name, n.snmpobj._ip))
                sys.stdout.flush()

            # set what details to discover for this node
            n.opts.get_router        = True
            n.opts.get_ospf_id       = True
            n.opts.get_bgp_las       = True
            n.opts.get_hsrp_pri      = True
            n.opts.get_hsrp_vip      = True
            n.opts.get_serial        = True 
            n.opts.get_stack         = True
            n.opts.get_stack_details = self.config.diagram.get_stack_members
            n.opts.get_vss           = True
            n.opts.get_vss_details   = self.config.diagram.get_vss_members
            n.opts.get_svi           = True
            n.opts.get_lo            = True
            n.opts.get_vpc           = True
            n.opts.get_ios           = True
            n.opts.get_plat          = True

            start = timer()
            n.query_node()
            end = timer()
            if (self.verbose > 0):
                print(' %.2f sec' % (end - start))

        # There is some back fill information we can populate now that
        # we know all there is to know.
        if (self.verbose > 0):
            print('\nBack filling node details...')

        for n in self.nodes:
            # Find and link VPC nodes together for easy reference later
            if ((n.vpc_domain != None) & (n.vpc_peerlink_node == None)):
                for link in n.links:
                    if ((link.local_port == n.vpc_peerlink_if) | (link.local_lag == n.vpc_peerlink_if)):
                        n.vpc_peerlink_node         = link.node
                        link.node.vpc_peerlink_node = n
                        break
766699
def mention(self):
        
        if self.username:
            return '@' + self.username
        if self.type == ChatType.PRIVATE:
            return self.full_name
        return None
559814
def get_context_data(self, **kwargs):
        
        context = super().get_context_data(**kwargs)
        context['topic'] = self.object
        context['forum'] = self.object.forum
        return context
1267982
def community_topic_show(self, id, **kwargs):
        ""
        api_path = "/api/v2/community/topics/{id}.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)
238708
def reply_topic(self, topic_id, content):
        
        data = {
            'body': content,
            'csrfmiddlewaretoken': self._request.cookies.get('csrftoken')
        }
        url = 'http://www.shanbay.com/api/v1/forum/thread/%s/post/' % topic_id
        r = self.request(url, 'post', data=data)
        j = r.json()
        if j['status_code'] == 0:
            return j['data']['thread']['id']
467807
def set_topic(self, channel_name, topic):
        
        channel_id = self.get_channel_id(channel_name)
        self.params.update({
            'channel': channel_id,
            'topic': topic,
            })
        return FromUrl('https://slack.com/api/channels.setTopic', self._requests)(data=self.params).post()
971294
def describe(name, tags=None, region=None, key=None, keyid=None,
             profile=None):
    '''
    

    '''
    res = __salt__['boto_rds.exists'](name, tags, region, key, keyid,
                                      profile)
    if not res.get('exists'):
        return {'exists': bool(res), 'message':
                'RDS instance {0} does not exist.'.format(name)}

    try:
        conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
        if not conn:
            return {'results': bool(conn)}

        rds = conn.describe_db_instances(DBInstanceIdentifier=name)
        rds = [
            i for i in rds.get('DBInstances', [])
            if i.get('DBInstanceIdentifier') == name
        ].pop(0)

        if rds:
            keys = ('DBInstanceIdentifier', 'DBInstanceClass', 'Engine',
                    'DBInstanceStatus', 'DBName', 'AllocatedStorage',
                    'PreferredBackupWindow', 'BackupRetentionPeriod',
                    'AvailabilityZone', 'PreferredMaintenanceWindow',
                    'LatestRestorableTime', 'EngineVersion',
                    'AutoMinorVersionUpgrade', 'LicenseModel',
                    'Iops', 'CharacterSetName', 'PubliclyAccessible',
                    'StorageType', 'TdeCredentialArn', 'DBInstancePort',
                    'DBClusterIdentifier', 'StorageEncrypted', 'KmsKeyId',
                    'DbiResourceId', 'CACertificateIdentifier',
                    'CopyTagsToSnapshot', 'MonitoringInterval',
                    'MonitoringRoleArn', 'PromotionTier',
                    'DomainMemberships')
            return {'rds': dict([(k, rds.get(k)) for k in keys])}
        else:
            return {'rds': None}
    except ClientError as e:
        return {'error': __utils__['boto3.get_error'](e)}
    except IndexError:
        return {'rds': None}
184094
def handle_topic(self, params):
        
        channel_name, sep, topic = params.partition(' ')

        channel = self.server.channels.get(channel_name)
        if not channel:
            raise IRCError.from_name(
                'nosuchnick', 'PRIVMSG :%s' % channel_name)
        if channel.name not in self.channels:
            # The user isn't in the channel.
            raise IRCError.from_name(
                'cannotsendtochan',
                '%s :Cannot send to channel' % channel.name)

        if topic:
            channel.topic = topic.lstrip(':')
            channel.topic_by = self.nick
        message = ':%s TOPIC %s :%s' % (
            self.client_ident(), channel_name,
            channel.topic)
        return message
638680
def create(name, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    conn.create_topic(name)
    log.info('Created SNS topic %s', name)
    _invalidate_cache()
    return True
1322953
def get_role_arn(role_name, env, region):
    
    session = boto3.Session(profile_name=env, region_name=region)
    iam_client = session.client('iam')

    LOG.debug('Searching for %s.', role_name)

    role = iam_client.get_role(RoleName=role_name)
    role_arn = role['Role']['Arn']

    LOG.debug("Found role's %s ARN %s", role_name, role_arn)

    return role_arn