// Secrets takes name of the imageStream, and returns the corresponding secretList object, and an error if there is any.
507295
func (c *FakeImageStreams) Secrets(imageStreamName string, options v1.GetOptions) (result *corev1.SecretList, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewGetSubresourceAction(imagestreamsResource, c.ns, "secrets", imageStreamName), &corev1.SecretList{})

	if obj == nil {
		return nil, err
	}
	return obj.(*corev1.SecretList), err
}
1284100
func (g *Guard) Secret(v []byte) (*Secret, error) {
	g.lock.Lock()
	defer g.lock.Unlock()

	b, err := memguard.NewMutableFromBytes(v)
	if err != nil {
		return nil, err
	}

	s := Secret{
		buffer: b,
		guard:  g,
	}

	g.secrets = append(g.secrets, &s)
	return &s, nil
}
288208
func (d *driver) secretTokenFromStore(secret string) (string, error) {
	if d.secretsStore == nil {
		return "", fmt.Errorf("A secret was passed in, but no secrets provider has been initialized")
	}

	token, err := d.secretsStore.GetToken(secret, "")
	if err != nil {
		return "", err
	}

	return token, nil
}
1160700
func (h Secretservice) List() (map[string]string, error) {
	credsLabelC := C.CString(credentials.CredsLabel)
	defer C.free(unsafe.Pointer(credsLabelC))

	var pathsC **C.char
	defer C.free(unsafe.Pointer(pathsC))
	var acctsC **C.char
	defer C.free(unsafe.Pointer(acctsC))
	var listLenC C.uint
	err := C.list(credsLabelC, &pathsC, &acctsC, &listLenC)
	if err != nil {
		defer C.g_error_free(err)
		return nil, errors.New("Error from list function in secretservice_linux.c likely due to error in secretservice library")
	}
	defer C.freeListData(&pathsC, listLenC)
	defer C.freeListData(&acctsC, listLenC)

	resp := make(map[string]string)

	listLen := int(listLenC)
	if listLen == 0 {
		return resp, nil
	}
	// The maximum capacity of the following two slices is limited to (2^29)-1 to remain compatible
	// with 32-bit platforms. The size of a `*C.char` (a pointer) is 4 Byte on a 32-bit system
	// and (2^29)*4 == math.MaxInt32 + 1. -- See issue golang/go#13656
	pathTmp := (*[(1 << 29) - 1]*C.char)(unsafe.Pointer(pathsC))[:listLen:listLen]
	acctTmp := (*[(1 << 29) - 1]*C.char)(unsafe.Pointer(acctsC))[:listLen:listLen]
	for i := 0; i < listLen; i++ {
		resp[C.GoString(pathTmp[i])] = C.GoString(acctTmp[i])
	}

	return resp, nil
}
563364
func (c *ClientsetCAStore) ListKeysets() ([]*kops.Keyset, error) {
	var items []*kops.Keyset

	{
		list, err := c.clientset.Keysets(c.namespace).List(v1.ListOptions{})
		if err != nil {
			return nil, fmt.Errorf("error listing Keysets: %v", err)
		}

		for i := range list.Items {
			keyset := &list.Items[i]
			switch keyset.Spec.Type {
			case kops.SecretTypeKeypair:
				items = append(items, &list.Items[i])

			case kops.SecretTypeSecret:
				continue // Ignore - this is handled by ClientsetSecretStore
			default:
				return nil, fmt.Errorf("unhandled secret type %q: %v", keyset.Spec.Type, err)
			}
		}
	}

	return items, nil
}
1266837
func Secret() (c *SecretController) {
	return &SecretController{
		List:   secretList,
		Delete: secretDelete,
		New:    secretNew,
		Create: secretCreate,
		Edit:   secretEdit,
		Update: secretUpdate,
	}
}
166010
func (s *Secret) Bytes() ([]byte, error) {
	if s.d == nil {
		return []byte{}, nil
	}

	buf := &bytes.Buffer{}
	if pw, found := s.d[passwordKey]; found {
		if sv, ok := pw.(string); ok {
			_, _ = buf.WriteString(sv)
		}
	}
	_, _ = buf.WriteString("\n")
	keys := make([]string, 0, len(s.d))
	for k := range s.d {
		keys = append(keys, k)
	}
	sort.Strings(keys)
	for _, k := range keys {
		v := s.d[k]
		if k == passwordKey {
			continue
		}
		_, _ = buf.WriteString(k)
		_, _ = buf.WriteString(": ")
		if sv, ok := v.(string); ok {
			_, _ = buf.WriteString(sv)
		}
		_, _ = buf.WriteString("\n")
	}
	return buf.Bytes(), nil
}
1200763
func NewSecretsProxy() *SecretsProxy {

	return &SecretsProxy{
		socketPath:      constants.DefaultSecretsPath,
		drivers:         cache.NewCache("secrets driver cache"),
		apiCacheMapping: cache.NewCache("secrets api cache"),
		cgroupCache:     cache.NewCache("secrets pu cache"),
		policyCache:     cache.NewCache("policy cache"),
	}
}
1323917
func (m *MockCoreV1Interface) Secrets(arg0 string) v11.SecretInterface {
	ret := m.ctrl.Call(m, "Secrets", arg0)
	ret0, _ := ret[0].(v11.SecretInterface)
	return ret0
}
597857
func (g *BuildGenerator) resolveImageSecret(ctx context.Context, secrets []corev1.Secret, imageRef *corev1.ObjectReference, buildNamespace string) *corev1.LocalObjectReference {
	if len(secrets) == 0 || imageRef == nil {
		return nil
	}
	// Get the image pull spec from the image stream reference
	imageSpec, err := g.resolveImageStreamDockerRepository(ctx, *imageRef, buildNamespace)
	if err != nil {
		klog.V(2).Infof("Unable to resolve the image name for %s/%s: %v", buildNamespace, imageRef, err)
		return nil
	}
	s := findDockerSecretAsInternalReference(secrets, imageSpec)
	if s == nil {
		klog.V(4).Infof("No secrets found for pushing or pulling the %s  %s/%s", imageRef.Kind, buildNamespace, imageRef.Name)
	}
	return s
}
1190128
func (c *client) SecretDelete(owner, name, secret string) error {
	uri := fmt.Sprintf(pathRepoSecret, c.addr, owner, name, secret)
	return c.delete(uri)
}
311275
func NewSecretService() (*SecretService, error) {
	conn, err := dbus.SessionBus()
	if err != nil {
		return nil, err
	}

	return &SecretService{
		conn,
		conn.Object(serviceName, servicePath),
	}, nil
}
417088
func (s *Secret) Data() map[string]interface{} {
	s.Lock()
	defer s.Unlock()

	return s.data
}
269212
func (_class SecretClass) GetAll(sessionID SessionRef) (_retval []SecretRef, _err error) {
	_method := "secret.get_all"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg)
	if _err != nil {
		return
	}
	_retval, _err = convertSecretRefSetToGo(_method + " -> ", _result.Value)
	return
}
1372274
func (p *Pod) GetSecretSource(name string) (string, error) {
	if val, ok := p.Secrets[name]; ok {
		return val.Source, nil
	}
	return "", fmt.Errorf("secret does not exist")
}
1103673
func SecretCreate(info *model.ConfigCreateInfo) error {
	return mgr.Do(func(ctx context.Context, cli *client.Client) (err error) {
		spec := swarm.SecretSpec{}
		spec.Name = info.Name
		if info.Base64 {
			spec.Data, err = base64.StdEncoding.DecodeString(info.Data)
			if err != nil {
				return
			}
		} else {
			spec.Data = []byte(info.Data)
		}
		spec.Labels = info.Labels.ToMap()
		if info.Template.Name != "" {
			spec.Templating = &swarm.Driver{
				Name:    info.Template.Name,
				Options: info.Template.Options,
			}
		}
		_, err = cli.SecretCreate(ctx, spec)
		return
	})
}
994919
func (cli *Client) SecretList(ctx context.Context, options types.SecretListOptions) ([]swarm.Secret, error) {
	if err := cli.NewVersionError("1.25", "secret list"); err != nil {
		return nil, err
	}
	query := url.Values{}

	if options.Filters.Len() > 0 {
		filterJSON, err := filters.ToJSON(options.Filters)
		if err != nil {
			return nil, err
		}

		query.Set("filters", filterJSON)
	}

	resp, err := cli.get(ctx, "/secrets", query, nil)
	defer ensureReaderClosed(resp)
	if err != nil {
		return nil, err
	}

	var secrets []swarm.Secret
	err = json.NewDecoder(resp.body).Decode(&secrets)
	return secrets, err
}