Create a new API key as reference for api.conf.

    :param api_name:
    :param api_key_name:
    :return: api_key
967842
def create_api_key(awsclient, api_name, api_key_name):
    
    _sleep()
    client_api = awsclient.get_client('apigateway')
    print('create api key: %s' % api_key_name)

    response = client_api.create_api_key(
        name=api_key_name,
        description='Created for ' + api_name,
        enabled=True
    )

    #print(json2table(response))

    print('Add this api key \'%s\' to your api.conf' % response['id'])
    return response['id']
1040448
def create_api_key(self):
        """"""
        apikeys = self.client.get_api_keys()
        for key in apikeys['items']:
            if key['name'] == self.app_name:
                self.log.info("Key %s already exists", self.app_name)
                break
        else:
            self.client.create_api_key(
                name=self.app_name, enabled=True, stageKeys=[{
                    'restApiId': self.api_id,
                    'stageName': self.env
                }])
            self.log.info("Successfully created API Key %s. Look in the AWS console for the key", self.app_name)
959334
function(apiKey) {
  return function(path, data, done) {
    var url = apiBase + path + '?' + querystring.stringify(_.extend({ 'key': apiKey }, data));
    request.get(url, globalResponseHandler({ url: url }, done));
  };
}
166004
def api_keys(self, serverid, api_key):
        
        if serverid and api_key:
            self.can_query = True # Yes, we _are_ (will be) configured
        self.serverid = int(serverid)
        self.api_key = api_key
        self.webhook_url = self.__base_url + str(self.serverid) + '/' + self.api_key
922106
def add_key(self, key_name, private):
        
        payload = {
            'name': key_name,
            'priv': private
        }

        data = json.dumps(payload)

        req = self.request(self.uri + '/keys', data=data)
        response = req.put().json()

        self.update_keys()
        return response
704123
def create_keypair(self, keypair_name):
        
        query = self.query_factory(
            action="CreateKeyPair", creds=self.creds, endpoint=self.endpoint,
            other_params={"KeyName": keypair_name})
        d = query.submit()
        return d.addCallback(self.parser.create_keypair)
163031
def api_key(request, response, verify_user, context=None, **kwargs):
    
    api_key = request.get_header('X-Api-Key')

    if api_key:
        try:
            user = verify_user(api_key)
        except TypeError:
            user = verify_user(api_key, context)
        if user:
            return user
        else:
            return False
    else:
        return None
639335
def create_namespace(
        name,
        **kwargs):
    '''
    
    '''

    meta_obj = kubernetes.client.V1ObjectMeta(name=name)
    body = kubernetes.client.V1Namespace(metadata=meta_obj)
    body.metadata.name = name

    cfg = _setup_conn(**kwargs)

    try:
        api_instance = kubernetes.client.CoreV1Api()
        api_response = api_instance.create_namespace(body)

        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->create_namespace'
            )
            raise CommandExecutionError(exc)
    finally:
        _cleanup(**cfg)
930656
def get_api_key(self, api_key_id):
        
        api = self._get_api(iam.DeveloperApi)
        return ApiKey(api.get_api_key(api_key_id))
98434
def add_api_stage_to_api_key(self, api_key, api_id, stage_name):
        
        self.apigateway_client.update_api_key(
            apiKey=api_key,
            patchOperations=[
                {
                    'op': 'add',
                    'path': '/stages',
                    'value': '{}/{}'.format(api_id, stage_name)
                }
            ]
        )
474621
def verify(api_key = nil)
      raise ConfigurationError, "You must provide an API key to verify" if api_key.nil? && self.api_key.nil?
      perform(:verify, { :providerkey => provider_key, :apikey => api_key || self.api_key }, :get, Success)
    end
1060917
def config_to_api_list(dic):
  
  config = [ ]
  for k, v in dic.iteritems():
    config.append({ 'name' : k, 'value': v })
  return { ApiList.LIST_KEY : config }
993499
def lookup_value(self, api_name, key):
        
        if api_name in self._cache:
            return self._cache[api_name].get(key, None)
        return None
782577
def createFromAPIKey(self, apikey, maybeWriteDefault=False):
        
        self._data = {
            'default_key': 'default',
            'keys': {
                'default': {
                    'key': apikey,
                    'desc': 'imported API key'
                }
            }
        }
        self._keyID = 'default'
        self._doDefaults()
        if maybeWriteDefault:
            path = os.path.expanduser(self.DEFAULT_CONFIG_FILE)
            self.write(path)
746565
def create_key(self, title, key):
        
        json = None
        if title and key:
            data = {'title': title, 'key': key}
            url = self._build_url('keys', base_url=self._api)
            json = self._json(self._post(url, data=data), 201)
        return Key(json, self) if json else None
940193
def django_api(
            self,
            name,
            introduced_at,
            undocumented=False,
            deprecated_at=None,
            title=None,
            **options):
        
        from acceptable.djangoutil import DjangoAPI
        location = get_callsite_location()
        api = DjangoAPI(
            self,
            name,
            introduced_at,
            options,
            location=location,
            undocumented=undocumented,
            deprecated_at=deprecated_at,
            title=title,
        )
        self.metadata.register_api(self.name, self.group, api)
        return api
233495
def update_api_key_description(apiKey, description, region=None, key=None, keyid=None, profile=None):
    '''
    

    '''
    try:
        conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
        response = _api_key_patch_replace(conn, apiKey, '/description', description)
        return {'updated': True, 'apiKey': _convert_datetime_str(response)}
    except ClientError as e:
        return {'updated': False, 'error': __utils__['boto3.get_error'](e)}