fabsdk

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package fabsdk enables client usage of a Hyperledger Fabric network.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithConfig

func WithConfig(config apiconfig.Config) apiconfig.ConfigProvider

WithConfig converts a Config interface to a ConfigProvider. This is a helper function for those who already loaded the config prior to instantiating the SDK.

Types

type ChannelClientOpts deprecated

type ChannelClientOpts struct {
	OrgName        string
	ConfigProvider apiconfig.Config
}

ChannelClientOpts provides options for creating channel client

Deprecated: Use NewClient instead.

type ChannelMgmtClientOpts deprecated

type ChannelMgmtClientOpts struct {
	OrgName        string
	ConfigProvider apiconfig.Config
}

ChannelMgmtClientOpts provides options for creating channel management client

Deprecated: Use NewClient instead.

type ClientContext

type ClientContext struct {
	// contains filtered or unexported fields
}

ClientContext represents the fabric transaction clients

func (*ClientContext) Channel

func (c *ClientContext) Channel(id string, opts ...ClientOption) (chclient.ChannelClient, error)

Channel returns a client API for transacting on a channel.

func (*ClientContext) ChannelMgmt

func (c *ClientContext) ChannelMgmt() (chmgmt.ChannelMgmtClient, error)

ChannelMgmt returns a client API for managing channels.

func (*ClientContext) ChannelService

func (c *ClientContext) ChannelService(id string) (apifabclient.ChannelService, error)

ChannelService returns a client API for interacting with a channel.

func (*ClientContext) ResourceMgmt

func (c *ClientContext) ResourceMgmt(opts ...ClientOption) (resmgmt.ResourceMgmtClient, error)

ResourceMgmt returns a client API for managing system resources.

func (*ClientContext) Session deprecated

func (c *ClientContext) Session() (apisdk.SessionContext, error)

Session returns the underlying identity of the client.

Deprecated: this method is temporary.

type ClientOption

type ClientOption func(opts *clientOptions) error

ClientOption configures the clients created by the SDK.

func WithTargetFilter

func WithTargetFilter(targetFilter apifabclient.TargetFilter) ClientOption

WithTargetFilter allows for filtering target peers.

type ContextOption

type ContextOption func(opts *contextOptions) error

ContextOption configures the client context created by the SDK.

func WithOrg

func WithOrg(name string) ContextOption

WithOrg uses the configuration and users from the named organization.

type FabricSDK

type FabricSDK struct {
	// contains filtered or unexported fields
}

FabricSDK provides access (and context) to clients being managed by the SDK.

func New

func New(cp apiconfig.ConfigProvider, opts ...Option) (*FabricSDK, error)

New initializes the SDK based on the set of options provided. configProvider provides the application configuration.

func (*FabricSDK) Config

func (sdk *FabricSDK) Config() apiconfig.Config

Config returns the SDK's configuration.

func (*FabricSDK) FabricProvider

func (sdk *FabricSDK) FabricProvider() api.FabricProvider

FabricProvider provides fabric objects such as peer and user

TODO: move under Providers()

func (*FabricSDK) NewChannelClient deprecated

func (sdk *FabricSDK) NewChannelClient(channelID string, userName string, opts ...ContextOption) (chclient.ChannelClient, error)

NewChannelClient returns a new client for a channel

Deprecated: Use NewClient instead.

func (*FabricSDK) NewChannelClientWithOpts deprecated

func (sdk *FabricSDK) NewChannelClientWithOpts(channelID string, userName string, opt *ChannelClientOpts) (chclient.ChannelClient, error)

NewChannelClientWithOpts returns a new client for a channel (user has to be pre-enrolled)

Deprecated: Use NewClient instead.

func (*FabricSDK) NewChannelMgmtClient deprecated

func (sdk *FabricSDK) NewChannelMgmtClient(userName string, opts ...ContextOption) (chmgmt.ChannelMgmtClient, error)

NewChannelMgmtClient returns a new client for managing channels

Deprecated: Use NewClient instead.

func (*FabricSDK) NewChannelMgmtClientWithOpts deprecated

func (sdk *FabricSDK) NewChannelMgmtClientWithOpts(userName string, opt *ChannelMgmtClientOpts) (chmgmt.ChannelMgmtClient, error)

NewChannelMgmtClientWithOpts returns a new client for managing channels with options

Deprecated: Use NewClient instead.

func (*FabricSDK) NewClient

func (sdk *FabricSDK) NewClient(identityOpt IdentityOption, opts ...ContextOption) *ClientContext

NewClient allows creation of transactions using the supplied identity as the credential.

func (*FabricSDK) NewPreEnrolledUser

func (sdk *FabricSDK) NewPreEnrolledUser(orgID string, userName string) (apifabclient.IdentityContext, error)

NewPreEnrolledUser returns a new pre-enrolled user

func (*FabricSDK) NewResourceMgmtClient deprecated

func (sdk *FabricSDK) NewResourceMgmtClient(userName string, opts ...ContextOption) (resmgmt.ResourceMgmtClient, error)

NewResourceMgmtClient returns a new client for managing system resources

Deprecated: Use NewClient instead.

func (*FabricSDK) NewResourceMgmtClientWithOpts deprecated

func (sdk *FabricSDK) NewResourceMgmtClientWithOpts(userName string, opt *ResourceMgmtClientOpts) (resmgmt.ResourceMgmtClient, error)

NewResourceMgmtClientWithOpts returns a new resource management client (user has to be pre-enrolled)

Deprecated: Use NewClient instead.

func (*FabricSDK) NewSystemClient deprecated

func (sdk *FabricSDK) NewSystemClient(s apisdk.SessionContext) (apifabclient.Resource, error)

NewSystemClient returns a new client for the system (operations not on a channel)

Deprecated: the system client is being replaced with the interfaces supplied by NewClient()

type IdentityOption

type IdentityOption func(s *identityOptions, sdk *FabricSDK, orgName string) error

IdentityOption provides parameters for creating a session (primarily from a fabric identity/user)

func WithIdentity

func WithIdentity(identity apifabclient.IdentityContext) IdentityOption

WithIdentity uses a pre-constructed identity object as the credential for the session

func WithUser

func WithUser(name string) IdentityOption

WithUser uses the named user to load the identity

type Option

type Option func(opts *options) error

Option configures the SDK.

func WithContextPkg

func WithContextPkg(context apisdk.OrgClientFactory) Option

WithContextPkg injects the context implementation into the SDK.

func WithCorePkg

func WithCorePkg(core apisdk.CoreProviderFactory) Option

WithCorePkg injects the core implementation into the SDK.

func WithLoggerPkg

func WithLoggerPkg(logger apilogging.LoggerProvider) Option

WithLoggerPkg injects the logger implementation into the SDK.

func WithServicePkg

func WithServicePkg(service apisdk.ServiceProviderFactory) Option

WithServicePkg injects the service implementation into the SDK.

func WithSessionPkg

func WithSessionPkg(session apisdk.SessionClientFactory) Option

WithSessionPkg injects the session implementation into the SDK.

type ResourceMgmtClientOpts deprecated

type ResourceMgmtClientOpts struct {
	OrgName        string
	TargetFilter   resmgmt.TargetFilter
	ConfigProvider apiconfig.Config
}

ResourceMgmtClientOpts provides options for creating resource management client

Deprecated: Use NewClient instead.

Directories

Path Synopsis
api
mocks
Package mock_api is a generated GoMock package.
Package mock_api is a generated GoMock package.
factory
provider

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL