// BuildIdentityConfigFromOptions will return an IdentityConfig instance pre-built with Optional interfaces
// provided in fabsdk's WithConfigIdentity(opts...) call
3819
func BuildIdentityConfigFromOptions(opts ...interface{}) (msp.IdentityConfig, error) {
	// build a new IdentityConfig with overridden function implementations
	c := &IdentityConfigOptions{}
	for _, option := range opts {
		err := setIdentityConfigWithOptionInterface(c, option)
		if err != nil {
			return nil, err
		}
	}

	return c, nil

}
685715
func (s *RegisterDeviceInput) SetIdentityId(v string) *RegisterDeviceInput {
	s.IdentityId = &v
	return s
}
1350543
func (ed *eventDescriptor) setIdentity(identity uint32) {
	ed.id = uint16(identity)
	ed.version = uint8(identity >> 16)
}
340417
func (s *CreateAuthorizerInput) SetIdentitySource(v []*string) *CreateAuthorizerInput {
	s.IdentitySource = v
	return s
}
322372
func (s *UpdateIdentityProviderConfigurationInput) SetIdentityProviderType(v string) *UpdateIdentityProviderConfigurationInput {
	s.IdentityProviderType = &v
	return s
}
1240218
func (s *SetIdentityMailFromDomainInput) SetIdentity(v string) *SetIdentityMailFromDomainInput {
	s.Identity = &v
	return s
}
581986
func (s *ActivityTaskStartedEventAttributes) SetIdentity(v string) *ActivityTaskStartedEventAttributes {
	s.Identity = &v
	return s
}
779391
func (mgr *MockIdentityManager) CreateSigningIdentity(opts ...msp.SigningIdentityOption) (msp.SigningIdentity, error) {
	return nil, errors.New("not implemented")
}
4827
func (c *fabricCAAdapter) CreateIdentity(key core.Key, cert []byte, request *api.IdentityRequest) (*api.IdentityResponse, error) {

	logger.Debugf("Creating identity [%s:%s]", request.ID, request.Affiliation)

	var attributes []caapi.Attribute
	for i := range request.Attributes {
		attributes = append(attributes, caapi.Attribute{Name: request.Attributes[i].Name, Value: request.Attributes[i].Value, ECert: request.Attributes[i].ECert})
	}

	// Create add identity request
	req := caapi.AddIdentityRequest{
		CAName:         request.CAName,
		ID:             request.ID,
		Affiliation:    request.Affiliation,
		Attributes:     attributes,
		Type:           request.Type,
		MaxEnrollments: request.MaxEnrollments,
		Secret:         request.Secret,
	}

	registrar, err := c.newIdentity(key, cert)
	if err != nil {
		return nil, errors.Wrap(err, "failed to create CA signing identity")
	}

	response, err := registrar.AddIdentity(&req)
	if err != nil {
		return nil, errors.Wrap(err, "failed to add identity")
	}

	return getIdentityResponse(response), nil
}
53763
func (s *PollForActivityTaskInput) SetIdentity(v string) *PollForActivityTaskInput {
	s.Identity = &v
	return s
}
674049
func (f *identityProviderFactoryImpl) NewIdentityProvider(ctx context.Context, config provider.IdentityProviderConfiguration) provider.IdentityProvider {
	return provider.NewIdentityProvider(config)
}
772880
func (s *DecisionTaskStartedEventAttributes) SetIdentity(v string) *DecisionTaskStartedEventAttributes {
	s.Identity = &v
	return s
}
956929
func (m *Machine) SetIdentity(id string) {
	m.Lock()
	defer m.Unlock()

	m.identity = id
}
495582
func configFromConfigSpec(spec *api.ConfigSpec) *api.Config {
	return &api.Config{
		ID:   identity.NewID(),
		Spec: *spec,
	}
}
37360
func (s *DeleteDatasetInput) SetIdentityId(v string) *DeleteDatasetInput {
	s.IdentityId = &v
	return s
}
241104
func (s *DescribeIdentityProviderConfigurationOutput) SetIdentityProviderType(v string) *DescribeIdentityProviderConfigurationOutput {
	s.IdentityProviderType = &v
	return s
}
286373
func (a *awsNodeVerifier) VerifyIdentity(ctx context.Context) ([]byte, error) {
	errs := make(chan error, 0)
	doneCh := make(chan []byte, 0)

	go func() {
		encoded, err := func() ([]byte, error) {
			// @step: create a metadata client
			client := ec2metadata.New(session.New())

			// @step: get the pkcs7 signature from the metadata service
			signature, err := client.GetDynamicData("/instance-identity/pkcs7")
			if err != nil {
				return []byte{}, err
			}

			// @step: construct request for the request
			request := &Request{
				Document: []byte(signature),
			}

			return json.Marshal(request)
		}()
		if err != nil {
			errs <- err
			return
		}

		doneCh <- encoded
	}()

	select {
	case <-ctx.Done():
		return nil, ctx.Err()
	case err := <-errs:
		return nil, err
	case req := <-doneCh:
		return req, nil
	}
}