本文整理汇总了Golang中github.com/juju/errors.NotImplementedf函数的典型用法代码示例。如果您正苦于以下问题:Golang NotImplementedf函数的具体用法?Golang NotImplementedf怎么用?Golang NotImplementedf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NotImplementedf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: SetStatus
// SetStatus sets the status of the service if the passed unitName,
// corresponding to the calling unit, is of the leader.
func (s *Service) SetStatus(unitName string, status params.Status, info string, data map[string]interface{}) error {
//TODO(perrito666) bump api version for this?
if s.st.facade.BestAPIVersion() < 2 {
return errors.NotImplementedf("SetStatus")
}
tag := names.NewUnitTag(unitName)
var result params.ErrorResults
args := params.SetStatus{
Entities: []params.EntityStatusArgs{
{
Tag: tag.String(),
Status: status,
Info: info,
Data: data,
},
},
}
err := s.st.facade.FacadeCall("SetServiceStatus", args, &result)
if err != nil {
if params.IsCodeNotImplemented(err) {
return errors.NotImplementedf("SetServiceStatus")
}
return errors.Trace(err)
}
return result.OneError()
}
开发者ID:felicianotech,项目名称:juju,代码行数:28,代码来源:service.go
示例2: DescribeVolumes
// DescribeVolumes is defined on storage.VolumeSource.
func (s *VolumeSource) DescribeVolumes(volIds []string) ([]storage.VolumeInfo, error) {
s.MethodCall(s, "DescribeVolumes", volIds)
if s.DescribeVolumesFunc != nil {
return s.DescribeVolumesFunc(volIds)
}
return nil, errors.NotImplementedf("DescribeVolumes")
}
开发者ID:claudiu-coblis,项目名称:juju,代码行数:8,代码来源:volumesource.go
示例3: AttachVolumes
// AttachVolumes is defined on storage.VolumeSource.
func (s *VolumeSource) AttachVolumes(params []storage.VolumeAttachmentParams) ([]storage.VolumeAttachment, error) {
s.MethodCall(s, "AttachVolumes", params)
if s.AttachVolumesFunc != nil {
return s.AttachVolumesFunc(params)
}
return nil, errors.NotImplementedf("AttachVolumes")
}
开发者ID:claudiu-coblis,项目名称:juju,代码行数:8,代码来源:volumesource.go
示例4: CreateVolume
func (ma *mockAdapter) CreateVolume(args cinder.CreateVolumeVolumeParams) (*cinder.Volume, error) {
ma.MethodCall(ma, "CreateVolume", args)
if ma.createVolume != nil {
return ma.createVolume(args)
}
return nil, errors.NotImplementedf("CreateVolume")
}
开发者ID:imoapps,项目名称:juju,代码行数:7,代码来源:cinder_test.go
示例5: AttachVolume
func (ma *mockAdapter) AttachVolume(serverId, volumeId, mountPoint string) (*nova.VolumeAttachment, error) {
ma.MethodCall(ma, "AttachVolume", serverId, volumeId, mountPoint)
if ma.attachVolume != nil {
return ma.attachVolume(serverId, volumeId, mountPoint)
}
return nil, errors.NotImplementedf("AttachVolume")
}
开发者ID:imoapps,项目名称:juju,代码行数:7,代码来源:cinder_test.go
示例6: AllMachinePorts
// AllMachinePorts returns all port ranges currently open on the given
// machine, mapped to the tags of the unit that opened them and the
// relation that applies.
func (st *State) AllMachinePorts(machineTag names.MachineTag) (map[network.PortRange]params.RelationUnit, error) {
if st.BestAPIVersion() < 1 {
// AllMachinePorts() was introduced in UniterAPIV1.
return nil, errors.NotImplementedf("AllMachinePorts() (need V1+)")
}
var results params.MachinePortsResults
args := params.Entities{
Entities: []params.Entity{{Tag: machineTag.String()}},
}
err := st.facade.FacadeCall("AllMachinePorts", args, &results)
if err != nil {
return nil, err
}
if len(results.Results) != 1 {
return nil, fmt.Errorf("expected 1 result, got %d", len(results.Results))
}
result := results.Results[0]
if result.Error != nil {
return nil, result.Error
}
portsMap := make(map[network.PortRange]params.RelationUnit)
for _, ports := range result.Ports {
portRange := ports.PortRange.NetworkPortRange()
portsMap[portRange] = params.RelationUnit{
Unit: ports.UnitTag,
Relation: ports.RelationTag,
}
}
return portsMap, nil
}
开发者ID:pmatulis,项目名称:juju,代码行数:33,代码来源:uniter.go
示例7: TestSinglePollWhenInstancInfoUnimplemented
func (s *machineSuite) TestSinglePollWhenInstancInfoUnimplemented(c *gc.C) {
s.PatchValue(&ShortPoll, 1*time.Millisecond)
s.PatchValue(&LongPoll, 1*time.Millisecond)
count := int32(0)
getInstanceInfo := func(id instance.Id) (instanceInfo, error) {
c.Check(id, gc.Equals, instance.Id("i1234"))
atomic.AddInt32(&count, 1)
return instanceInfo{}, errors.NotImplementedf("instance address")
}
context := &testMachineContext{
getInstanceInfo: getInstanceInfo,
dyingc: make(chan struct{}),
}
m := &testMachine{
id: "99",
instanceId: "i1234",
refresh: func() error { return nil },
life: state.Alive,
}
died := make(chan machine)
go runMachine(context, m, nil, died)
time.Sleep(coretesting.ShortWait)
killMachineLoop(c, m, context.dyingc, died)
c.Assert(context.killAllErr, gc.Equals, nil)
c.Assert(count, gc.Equals, int32(1))
}
开发者ID:kapilt,项目名称:juju,代码行数:28,代码来源:machine_test.go
示例8: CreateVolumes
// CreateVolumes is defined on storage.VolumeSource.
func (s *VolumeSource) CreateVolumes(params []storage.VolumeParams) ([]storage.CreateVolumesResult, error) {
s.MethodCall(s, "CreateVolumes", params)
if s.CreateVolumesFunc != nil {
return s.CreateVolumesFunc(params)
}
return nil, errors.NotImplementedf("CreateVolumes")
}
开发者ID:imoapps,项目名称:juju,代码行数:8,代码来源:volumesource.go
示例9: ErrIfNotVersionFn
// ErrIfNotVersionFn returns a function which can be used to check for
// the minimum supported version, and, if appropriate, generate an
// error.
func ErrIfNotVersionFn(minVersion int, bestApiVersion int) func(string) error {
return func(fnName string) error {
if minVersion <= bestApiVersion {
return nil
}
return errors.NotImplementedf("%s(...) requires v%d+", fnName, minVersion)
}
}
开发者ID:pmatulis,项目名称:juju,代码行数:11,代码来源:uniter.go
示例10: DetachVolumes
// DetachVolumes is defined on storage.VolumeSource.
func (s *VolumeSource) DetachVolumes(params []storage.VolumeAttachmentParams) error {
s.MethodCall(s, "DetachVolumes", params)
if s.DetachVolumesFunc != nil {
return s.DetachVolumesFunc(params)
}
return errors.NotImplementedf("DetachVolumes")
}
开发者ID:claudiu-coblis,项目名称:juju,代码行数:9,代码来源:volumesource.go
示例11: InstanceDistributor
// InstanceDistributor implements state.Policy.
func (p environStatePolicy) InstanceDistributor() (instance.Distributor, error) {
env, err := p.getEnviron(p.st)
if err != nil {
return nil, err
}
if p, ok := env.(instance.Distributor); ok {
return p, nil
}
return nil, errors.NotImplementedf("InstanceDistributor")
}
开发者ID:bac,项目名称:juju,代码行数:11,代码来源:policy.go
示例12: ProviderConfigSchemaSource
// ProviderConfigSchemaSource implements state.Policy.
func (p environStatePolicy) ProviderConfigSchemaSource() (config.ConfigSchemaSource, error) {
provider, err := environProvider(p.st)
if err != nil {
return nil, errors.Trace(err)
}
if cs, ok := provider.(config.ConfigSchemaSource); ok {
return cs, nil
}
return nil, errors.NotImplementedf("config.ConfigSource")
}
开发者ID:bac,项目名称:juju,代码行数:11,代码来源:policy.go
示例13: InstanceDistributor
func (environStatePolicy) InstanceDistributor(cfg *config.Config) (state.InstanceDistributor, error) {
env, err := New(cfg)
if err != nil {
return nil, err
}
if p, ok := env.(state.InstanceDistributor); ok {
return p, nil
}
return nil, errors.NotImplementedf("InstanceDistributor")
}
开发者ID:imoapps,项目名称:juju,代码行数:10,代码来源:statepolicy.go
示例14: DestroyVolumes
// DestroyVolumes is defined on storage.VolumeSource.
func (s *VolumeSource) DestroyVolumes(volIds []string) []error {
s.MethodCall(s, "DestroyVolumes", volIds)
if s.DestroyVolumesFunc != nil {
return s.DestroyVolumesFunc(volIds)
}
errs := make([]error, len(volIds))
for i := range errs {
errs[i] = errors.NotImplementedf("DestroyVolumes")
}
return errs
}
开发者ID:claudiu-coblis,项目名称:juju,代码行数:12,代码来源:volumesource.go
示例15: TestEnvironCapabilityUnimplemented
func (s *EnvironCapabilitySuite) TestEnvironCapabilityUnimplemented(c *gc.C) {
var capabilityErr error
s.policy.GetEnvironCapability = func(*config.Config) (state.EnvironCapability, error) {
return nil, capabilityErr
}
_, err := s.addOneMachine(c)
c.Assert(err, gc.ErrorMatches, "cannot add a new machine: policy returned nil EnvironCapability without an error")
capabilityErr = errors.NotImplementedf("EnvironCapability")
_, err = s.addOneMachine(c)
c.Assert(err, gc.IsNil)
}
开发者ID:jiasir,项目名称:juju,代码行数:11,代码来源:environcapability_test.go
示例16: TestPrecheckPrecheckerUnimplemented
func (s *PrecheckerSuite) TestPrecheckPrecheckerUnimplemented(c *gc.C) {
var precheckerErr error
s.policy.GetPrechecker = func(*config.Config) (state.Prechecker, error) {
return nil, precheckerErr
}
_, err := s.addOneMachine(c, constraints.Value{}, "placement")
c.Assert(err, gc.ErrorMatches, "cannot add a new machine: policy returned nil prechecker without an error")
precheckerErr = errors.NotImplementedf("Prechecker")
_, err = s.addOneMachine(c, constraints.Value{}, "placement")
c.Assert(err, jc.ErrorIsNil)
}
开发者ID:imoapps,项目名称:juju,代码行数:11,代码来源:prechecker_test.go
示例17: TestConfigValidateUnimplemented
func (s *ConfigValidatorSuite) TestConfigValidateUnimplemented(c *gc.C) {
var configValidatorErr error
s.policy.GetConfigValidator = func() (config.Validator, error) {
return nil, configValidatorErr
}
err := s.updateModelConfig(c)
c.Assert(err, gc.ErrorMatches, "policy returned nil configValidator without an error")
configValidatorErr = errors.NotImplementedf("Validator")
err = s.updateModelConfig(c)
c.Assert(err, jc.ErrorIsNil)
}
开发者ID:bac,项目名称:juju,代码行数:12,代码来源:configvalidator_test.go
示例18: TestConfigValidateUnimplemented
func (s *ConfigValidatorSuite) TestConfigValidateUnimplemented(c *gc.C) {
var configValidatorErr error
s.policy.getConfigValidator = func(string) (state.ConfigValidator, error) {
return nil, configValidatorErr
}
err := s.updateEnvironConfig(c)
c.Assert(err, gc.ErrorMatches, "policy returned nil configValidator without an error")
configValidatorErr = errors.NotImplementedf("Validator")
err = s.updateEnvironConfig(c)
c.Assert(err, gc.IsNil)
}
开发者ID:jkary,项目名称:core,代码行数:12,代码来源:configvalidator_test.go
示例19: TestInstanceDistributorUnimplemented
func (s *InstanceDistributorSuite) TestInstanceDistributorUnimplemented(c *gc.C) {
s.setupScenario(c)
var distributorErr error
s.policy.GetInstanceDistributor = func(*config.Config) (state.InstanceDistributor, error) {
return nil, distributorErr
}
unit, err := s.wordpress.AddUnit()
c.Assert(err, gc.IsNil)
_, err = unit.AssignToCleanMachine()
c.Assert(err, gc.ErrorMatches, `cannot assign unit "wordpress/1" to clean machine: policy returned nil instance distributor without an error`)
distributorErr = errors.NotImplementedf("InstanceDistributor")
_, err = unit.AssignToCleanMachine()
c.Assert(err, gc.IsNil)
}
开发者ID:kapilt,项目名称:juju,代码行数:14,代码来源:distribution_test.go
示例20: serveLoginGet
func (h *localLoginHandlers) serveLoginGet(p httprequest.Params) (interface{}, error) {
if p.Request.Header.Get("Accept") == "application/json" {
// The application/json content-type is used to
// inform the client of the supported auth methods.
return map[string]string{
"juju_userpass": p.Request.URL.String(),
}, nil
}
// TODO(axw) return an HTML form. If waitid is supplied,
// it should be passed through so we can unblock a request
// on the /auth/wait endpoint. We should also support logging
// in when not specifically directed to the login page.
return nil, errors.NotImplementedf("GET")
}
开发者ID:bac,项目名称:juju,代码行数:14,代码来源:locallogin.go
注:本文中的github.com/juju/errors.NotImplementedf函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论