本文整理汇总了Golang中github.com/juju/juju/apiserver/params.ErrorResults.OneError方法的典型用法代码示例。如果您正苦于以下问题:Golang ErrorResults.OneError方法的具体用法?Golang ErrorResults.OneError怎么用?Golang ErrorResults.OneError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/juju/apiserver/params.ErrorResults
的用法示例。
在下文中一共展示了ErrorResults.OneError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ServiceDeploy
// ServiceDeploy obtains the charm, either locally or from
// the charm store, and deploys it. It allows the specification of
// requested networks that must be present on the machines where the
// service is deployed. Another way to specify networks to include/exclude
// is using constraints.
func (c *Client) ServiceDeploy(
charmURL string,
serviceName string,
numUnits int,
configYAML string,
cons constraints.Value,
toMachineSpec string,
networks []string,
storage map[string]storage.Constraints,
) error {
args := params.ServicesDeploy{
Services: []params.ServiceDeploy{{
ServiceName: serviceName,
CharmUrl: charmURL,
NumUnits: numUnits,
ConfigYAML: configYAML,
Constraints: cons,
ToMachineSpec: toMachineSpec,
Networks: networks,
Storage: storage,
}},
}
var results params.ErrorResults
err := c.facade.FacadeCall("ServicesDeploy", args, &results)
if err != nil {
return err
}
return results.OneError()
}
示例2: Deploy
// Deploy obtains the charm, either locally or from
// the charm store, and deploys it. It allows the specification of
// requested networks that must be present on the machines where the
// service is deployed. Another way to specify networks to include/exclude
// is using constraints. Placement directives, if provided, specify the
// machine on which the charm is deployed.
func (c *Client) Deploy(
charmURL string,
serviceName string,
series string,
numUnits int,
configYAML string,
cons constraints.Value,
placement []*instance.Placement,
networks []string,
storage map[string]storage.Constraints,
) error {
args := params.ServicesDeploy{
Services: []params.ServiceDeploy{{
ServiceName: serviceName,
Series: series,
CharmUrl: charmURL,
NumUnits: numUnits,
ConfigYAML: configYAML,
Constraints: cons,
Placement: placement,
Networks: networks,
Storage: storage,
}},
}
var results params.ErrorResults
var err error
err = c.facade.FacadeCall("Deploy", args, &results)
if err != nil {
return err
}
return results.OneError()
}
示例3: Deploy
// Deploy obtains the charm, either locally or from the charm store,
// and deploys it. It allows the specification of requested networks
// that must be present on the machines where the service is
// deployed. Another way to specify networks to include/exclude is
// using constraints. Placement directives, if provided, specify the
// machine on which the charm is deployed.
func (c *Client) Deploy(args DeployArgs) error {
deployArgs := params.ServicesDeploy{
Services: []params.ServiceDeploy{{
ServiceName: args.ServiceName,
Series: args.Series,
CharmUrl: args.CharmID.URL.String(),
Channel: string(args.CharmID.Channel),
NumUnits: args.NumUnits,
ConfigYAML: args.ConfigYAML,
Constraints: args.Cons,
Placement: args.Placement,
Networks: args.Networks,
Storage: args.Storage,
EndpointBindings: args.EndpointBindings,
Resources: args.Resources,
}},
}
var results params.ErrorResults
var err error
err = c.facade.FacadeCall("Deploy", deployArgs, &results)
if err != nil {
return err
}
return results.OneError()
}
示例4: 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()
}
示例5: RemoveUser
func (c *Client) RemoveUser(tag string) error {
u := params.Entity{Tag: tag}
p := params.Entities{Entities: []params.Entity{u}}
results := new(params.ErrorResults)
err := c.facade.FacadeCall("RemoveUser", p, results)
if err != nil {
return errors.Trace(err)
}
return results.OneError()
}
示例6: SetInstanceStatus
// SetInstanceStatus sets the instance status of the machine.
func (m *Machine) SetInstanceStatus(status string) error {
var result params.ErrorResults
args := params.SetInstancesStatus{Entities: []params.InstanceStatus{
{Tag: m.tag.String(), Status: status},
}}
err := m.facade.FacadeCall("SetInstanceStatus", args, &result)
if err != nil {
return err
}
return result.OneError()
}
示例7: ReleaseContainerAddresses
// ReleaseContainerAddresses releases a static IP address allocated to a
// container.
func (st *State) ReleaseContainerAddresses(containerTag names.MachineTag) (err error) {
defer errors.DeferredAnnotatef(&err, "cannot release static addresses for %q", containerTag.Id())
var result params.ErrorResults
args := params.Entities{
Entities: []params.Entity{{Tag: containerTag.String()}},
}
if err := st.facade.FacadeCall("ReleaseContainerAddresses", args, &result); err != nil {
return err
}
return result.OneError()
}
示例8: Remove
// Remove removes the IP address.
func (a *IPAddress) Remove() error {
var result params.ErrorResults
args := params.Entities{
Entities: []params.Entity{{Tag: a.tag.String()}},
}
err := a.facade.FacadeCall("Remove", args, &result)
if err != nil {
return err
}
return result.OneError()
}
示例9: SetProviderNetworkConfig
// SetProviderNetworkConfig sets the machine network config as seen by the
// provider.
func (m *Machine) SetProviderNetworkConfig() error {
var result params.ErrorResults
args := params.Entities{
Entities: []params.Entity{{Tag: m.tag.String()}},
}
err := m.st.facade.FacadeCall("SetProviderNetworkConfig", args, &result)
if err != nil {
return err
}
return result.OneError()
}
示例10: CreateSpace
// CreateSpace creates a new Juju network space, associating the
// specified subnets with it (optional; can be empty).
func (api *API) CreateSpace(name string, subnetIds []string, public bool) error {
var response params.ErrorResults
params := params.CreateSpacesParams{
Spaces: []params.CreateSpaceParams{makeCreateSpaceParams(name, subnetIds, public)},
}
err := api.facade.FacadeCall("CreateSpaces", params, &response)
if err != nil {
return errors.Trace(err)
}
return response.OneError()
}
示例11: DestroyAllSubordinates
// DestroyAllSubordinates destroys all subordinates of the unit.
func (u *Unit) DestroyAllSubordinates() error {
var result params.ErrorResults
args := params.Entities{
Entities: []params.Entity{{Tag: u.tag.String()}},
}
err := u.st.facade.FacadeCall("DestroyAllSubordinates", args, &result)
if err != nil {
return err
}
return result.OneError()
}
示例12: CleanupOldMetrics
// CleanupOldMetrics looks for metrics that are 24 hours old (or older)
// and have been sent. Any metrics it finds are deleted.
func (c *Client) CleanupOldMetrics() error {
p := params.Entities{Entities: []params.Entity{
{c.st.EnvironTag()},
}}
results := new(params.ErrorResults)
err := c.facade.FacadeCall("CleanupOldMetrics", p, results)
if err != nil {
return errors.Trace(err)
}
return results.OneError()
}
示例13: Remove
// Remove removes the machine from state. It will fail if the machine
// is not Dead.
func (m *Machine) Remove() error {
var result params.ErrorResults
args := params.Entities{
Entities: []params.Entity{{Tag: m.tag.String()}},
}
err := m.st.facade.FacadeCall("Remove", args, &result)
if err != nil {
return err
}
return result.OneError()
}
示例14: SetInstanceStatus
// SetInstanceStatus sets the status for the provider instance.
func (m *Machine) SetInstanceStatus(status status.Status, message string, data map[string]interface{}) error {
var result params.ErrorResults
args := params.SetStatus{Entities: []params.EntityStatusArgs{
{Tag: m.tag.String(), Status: status.String(), Info: message, Data: data},
}}
err := m.st.facade.FacadeCall("SetInstanceStatus", args, &result)
if err != nil {
return err
}
return result.OneError()
}
示例15: SendMetrics
// SendMetrics will send any unsent metrics to the collection service.
func (c *Client) SendMetrics() error {
p := params.Entities{Entities: []params.Entity{
{c.modelTag.String()},
}}
var results params.ErrorResults
err := c.facade.FacadeCall("SendMetrics", p, &results)
if err != nil {
return errors.Trace(err)
}
return results.OneError()
}