Destroy DNS records.

    Args:
        app (str): Spinnaker Application name.
        env (str): Deployment environment.
        regions (str): AWS region.

    Returns:
        bool: True upon successful completion.
343196
def destroy_dns(app='', env='dev', **_):
    
    client = boto3.Session(profile_name=env).client('route53')

    generated = get_details(app=app, env=env)
    record = generated.dns_elb()

    zone_ids = get_dns_zone_ids(env=env, facing='external')

    for zone_id in zone_ids:
        record_sets = client.list_resource_record_sets(
            HostedZoneId=zone_id, StartRecordName=record, StartRecordType='CNAME', MaxItems='1')

        for found_record in record_sets['ResourceRecordSets']:
            assert destroy_record(client=client, found_record=found_record, record=record, zone_id=zone_id)

    return True
149937
def call_failure_app(env, options = {})
      if config.failure_app
        options.merge!(:attempted_path => ::Rack::Request.new(env).fullpath)
        env["PATH_INFO"] = "/#{options[:action]}"
        env["warden.options"] = options

        _run_callbacks(:before_failure, env, options)
        config.failure_app.call(env).to_a
      else
        raise "No Failure App provided"
      end
    end
1133569
def delete_app_info(app_id):
    
    try:
        conn = get_conn()
        c = conn.cursor()
        c.execute("DELETE FROM container WHERE app_id='{0}'".format(app_id))
        c.execute("DELETE FROM app WHERE id='{0}'".format(app_id))
        conn.commit()
        #print 'clear old app %s in db succeed!' % app_id
    except Exception, e:
        raise RuntimeError('clear old app %s in db failed! %s' % (app_id,e))
323630
def create_failover_dns(self, primary_region='us-east-1'):
        
        dns_record = self.generated.dns()['global']
        zone_ids = get_dns_zone_ids(env=self.env, facing=self.elb_subnet)

        elb_dns_aws = find_elb(name=self.app_name, env=self.env, region=self.region)
        elb_dns_zone_id = find_elb_dns_zone_id(name=self.app_name, env=self.env, region=self.region)

        if primary_region in elb_dns_aws:
            failover_state = 'PRIMARY'
        else:
            failover_state = 'SECONDARY'
        self.log.info("%s set as %s record", elb_dns_aws, failover_state)

        self.log.info('Updating Application Failover URL: %s', dns_record)

        dns_kwargs = {
            'dns_name': dns_record,
            'elb_dns_zone_id': elb_dns_zone_id,
            'elb_aws_dns': elb_dns_aws,
            'dns_ttl': self.dns_ttl,
            'failover_state': failover_state,
        }

        for zone_id in zone_ids:
            self.log.debug('zone_id: %s', zone_id)
            update_failover_dns_record(self.env, zone_id, **dns_kwargs)

        return dns_record
1348127
def rm_app(id):
    '''
    
    '''
    response = salt.utils.http.query(
        "{0}/v2/apps/{1}".format(_base_url(), id),
        method='DELETE',
        decode_type='json',
        decode=True,
    )
    return response['dict']
1309321
function remove(appName, domain, callback) {
    var url = format('/%s/apps/%s/domains/%s', deis.version, appName, domain);
    commons.del(url, callback);
  }
1170902
def main():  # noqa
    """"""
    logging.basicConfig(format=LOGGING_FORMAT)

    parser = argparse.ArgumentParser(description=main.__doc__)
    add_debug(parser)
    add_app(parser)
    args = parser.parse_args()

    if args.debug == logging.DEBUG:
        logging.getLogger(__package__.split('.')[0]).setLevel(args.debug)
    else:
        LOG.setLevel(args.debug)

    for env in ENVS:
        for region in REGIONS:
            LOG.info('DESTROY %s:%s', env, region)

            try:
                destroy_dns(app=args.app, env=env)
            except botocore.exceptions.ClientError as error:
                LOG.warning('DNS issue for %s in %s: %s', env, region, error)

            try:
                destroy_elb(app=args.app, env=env, region=region)
            except SpinnakerError:
                pass

            try:
                destroy_iam(app=args.app, env=env)
            except botocore.exceptions.ClientError as error:
                LOG.warning('IAM issue for %s in %s: %s', env, region, error)

            try:
                destroy_s3(app=args.app, env=env)
            except botocore.exceptions.ClientError as error:
                LOG.warning('S3 issue for %s in %s: %s', env, region, error)

            try:
                destroy_sg(app=args.app, env=env, region=region)
            except SpinnakerError:
                pass

            LOG.info('Destroyed %s:%s', env, region)

    LOG.info('Destruction complete.')
1208618
def destroy(ctx, app, expire_hit, sandbox):
    """"""
    if expire_hit:
        ctx.invoke(expire, app=app, sandbox=sandbox, exit=False)
    HerokuApp(app).destroy()
154223
def server_delete(s_name, **connection_args):
    '''
    
    '''
    ret = True
    server = _server_get(s_name, **connection_args)
    if server is None:
        return False
    nitro = _connect(**connection_args)
    if nitro is None:
        return False
    try:
        NSServer.delete(nitro, server)
    except NSNitroError as error:
        log.debug('netscaler module error - NSServer.delete() failed: %s', error)
        ret = False
    _disconnect(nitro)
    return ret
1322072
def delete(gandi, resource):
    

    result = gandi.dnssec.delete(resource)
    gandi.echo('Delete successful.')

    return result
310542
def delete_topic(TopicArn, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    try:
        conn.delete_topic(TopicArn=TopicArn)
        log.info('SNS topic %s deleted', TopicArn)
        return True
    except botocore.exceptions.ClientError as e:
        log.error('Failed to delete SNS topic %s: %s', name, e)
        return False
645614
def _can_process_application(self, app):
        
        return (self.LOCATION_KEY in app.properties and
                isinstance(app.properties[self.LOCATION_KEY], dict) and
                self.APPLICATION_ID_KEY in app.properties[self.LOCATION_KEY] and
                self.SEMANTIC_VERSION_KEY in app.properties[self.LOCATION_KEY])
14677
def delete_api_deployment(restApiId, deploymentId, region=None, key=None, keyid=None, profile=None):
    '''
    

    '''
    try:
        conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
        conn.delete_deployment(restApiId=restApiId, deploymentId=deploymentId)
        return {'deleted': True}
    except ClientError as e:
        return {'deleted': False, 'error': __utils__['boto3.get_error'](e)}
40663
function foward(app, options) {
  if (typeof options.name === 'string') {
    app.name = options.name;
    delete options.name;
  }
  Scaffold.emit('scaffold', app);
  emit('target', app, Scaffold);
  emit('files', app, Scaffold);
}
1286451
async def on_shutdown(self, app):
        
        for ws in self.clients.copy():
            await ws.close(code=WSCloseCode.GOING_AWAY,
                           message='Server shutdown')
        self.shutdown()
154961
def unset_env(self, key):
        """"""
        os.environ.pop(make_env_key(self.appname, key), None)
        self._registered_env_keys.discard(key)
        self._clear_memoization()
494196
def destroy_iam(app='', env='dev', **_):
    
    session = boto3.Session(profile_name=env)
    client = session.client('iam')

    generated = get_details(env=env, app=app)
    generated_iam = generated.iam()
    app_details = collections.namedtuple('AppDetails', generated_iam.keys())
    details = app_details(**generated_iam)

    LOG.debug('Application details: %s', details)

    resource_action(
        client,
        action='remove_user_from_group',
        log_format='Removed user from group: %(UserName)s ~> %(GroupName)s',
        GroupName=details.group,
        UserName=details.user)
    resource_action(client, action='delete_user', log_format='Destroyed user: %(UserName)s', UserName=details.user)
    resource_action(client, action='delete_group', log_format='Destroyed group: %(GroupName)s', GroupName=details.group)

    resource_action(
        client,
        action='remove_role_from_instance_profile',
        log_format='Destroyed Instance Profile from Role: '
        '%(InstanceProfileName)s ~> %(RoleName)s',
        InstanceProfileName=details.profile,
        RoleName=details.role)
    resource_action(
        client,
        action='delete_instance_profile',
        log_format='Destroyed Instance Profile: %(InstanceProfileName)s',
        InstanceProfileName=details.profile)

    role_policies = []
    try:
        role_policies = resource_action(
            client,
            action='list_role_policies',
            log_format='Found Role Policies for %(RoleName)s.',
            RoleName=details.role)['PolicyNames']
    except TypeError:
        LOG.info('Role %s not found.', details.role)

    for policy in role_policies:
        resource_action(
            client,
            action='delete_role_policy',
            log_format='Removed Inline Policy from Role: '
            '%(PolicyName)s ~> %(RoleName)s',
            RoleName=details.role,
            PolicyName=policy)

    attached_role_policies = []
    try:
        attached_role_policies = resource_action(
            client,
            action='list_attached_role_policies',
            log_format='Found attached Role Polices for %(RoleName)s.',
            RoleName=details.role)['AttachedPolicies']
    except TypeError:
        LOG.info('Role %s not found.', details.role)

    for policy in attached_role_policies:
        resource_action(
            client,
            action='detach_role_policy',
            log_format='Detached Policy from Role: '
            '%(PolicyArn)s ~> %(RoleName)s',
            RoleName=details.role,
            PolicyArn=policy['PolicyArn'])

    resource_action(client, action='delete_role', log_format='Destroyed Role: %(RoleName)s', RoleName=details.role)