// CreateKey creates a new key with the specified options.
// See API docs: http://apidocs.joyent.com/cloudapi/#CreateKey
550163
func (c *Client) CreateKey(opts CreateKeyOpts) (*Key, error) {
	var resp Key
	req := request{
		method:         client.POST,
		url:            apiKeys,
		reqValue:       opts,
		resp:           &resp,
		expectedStatus: http.StatusCreated,
	}
	if _, err := c.sendRequest(req); err != nil {
		return nil, errors.Newf(err, "failed to create key with name: %s", opts.Name)
	}
	return &resp, nil
}
606332
func (o *InfrastructureAccessProfile) CreateSSHKey(child *SSHKey) *bambou.Error {

	return bambou.CurrentSession().CreateChild(o, child)
}
1074335
func (s *InstanceInformationStringFilter) SetKey(v string) *InstanceInformationStringFilter {
	s.Key = &v
	return s
}
744614
func (s *CreateTagOptionInput) SetKey(v string) *CreateTagOptionInput {
	s.Key = &v
	return s
}
443019
func (s *MultipartUpload) SetKey(v string) *MultipartUpload {
	s.Key = &v
	return s
}
308343
func (s *ProvisioningParameter) SetKey(v string) *ProvisioningParameter {
	s.Key = &v
	return s
}
972847
func (c *Config) PutKey(key Key, value interface{}) (changed bool) {
	return c.values.Put(key, value)
}
632737
func (s Storage) Create(bucket, key string, value []byte, nested ...string) Storage {
	return s.execute(bucket, key, value, nested, create)
}
1121058
func (k *KeyManager) InstallKey(key string) (*KeyResponse, error) {
	return k.InstallKeyWithOptions(key, nil)
}
1099295
func CreateDeployKey(c *context.APIContext, form api.CreateKeyOption) {
	content, err := models.CheckPublicKeyString(form.Key)
	if err != nil {
		HandleCheckKeyStringError(c, err)
		return
	}

	key, err := models.AddDeployKey(c.Repo.Repository.ID, form.Title, content)
	if err != nil {
		HandleAddKeyError(c, err)
		return
	}

	key.Content = content
	apiLink := composeDeployKeysAPILink(c.Repo.Owner.Name + "/" + c.Repo.Repository.Name)
	c.JSON(201, convert.ToDeployKey(apiLink, key))
}
594558
func (configurationApi *ConfigurationApi) Create(body []byte, options map[string]string) ([]byte, error) {
	request := api.CcaRequest{
		Method:   api.POST,
		Body:     body,
		Endpoint: configurationApi.buildEndpoint(),
		Options:  options,
	}
	response, err := configurationApi.apiClient.Do(request)
	if err != nil {
		return nil, err
	} else if response.IsError() {
		return nil, api.CcaErrorResponse(*response)
	}
	return response.Data, nil
}
853925
func (c CloudstackClient) CreateSSHKeyPair(name string) (CreateSshKeyPairResponse, error) {
	var resp CreateSshKeyPairResponse
	params := url.Values{}
	params.Set("name", name)
	response, err := NewRequest(c, "createSSHKeyPair", params)
	if err != nil {
		return resp, err
	}
	resp = response.(CreateSshKeyPairResponse)
	return resp, nil
}
1111117
func (s *AccessLevelFilter) SetKey(v string) *AccessLevelFilter {
	s.Key = &v
	return s
}
535
func NewKey() (*[SecretKeyLength]byte, error) {
	// get 32-bytes of random from /dev/urandom
	bytes, err := randomProvider.Bytes(SecretKeyLength)
	if err != nil {
		return nil, fmt.Errorf("unable to generate random: %v", err)
	}

	return KeySliceToArray(bytes)
}
51144
func createCacheKey(ei *dosa.EntityInfo, values map[string]dosa.FieldValue) interface{} {
	var keys []string
	for pk := range ei.Def.KeySet() {
		if _, ok := values[pk]; ok {
			keys = append(keys, pk)
		}
	}

	// sort the keys so that we encode in a deterministic order
	sort.Strings(keys)
	var orderedKeys []map[string]dosa.FieldValue
	for _, k := range keys {
		orderedKeys = append(orderedKeys, map[string]dosa.FieldValue{k: values[k]})
	}

	return orderedKeys
}
536785
func New(key, email string, opts ...Option) (*API, error) {
	if key == "" || email == "" {
		return nil, errors.New(errEmptyCredentials)
	}

	api, err := newClient(opts...)
	if err != nil {
		return nil, err
	}

	api.APIKey = key
	api.APIEmail = email
	api.authType = AuthKeyEmail

	return api, nil
}
22584
func (a *DispatchKeyEventArgs) SetKey(key string) *DispatchKeyEventArgs {
	a.Key = &key
	return a
}