func (c *Client) Consume(arg crossmodel.ConsumeApplicationArgs) (string, error) {
	var consumeRes params.ErrorResults
	args := params.ConsumeApplicationArgs{
		Args: []params.ConsumeApplicationArg{{
			ApplicationOfferDetails: arg.Offer,
			ApplicationAlias:        arg.ApplicationAlias,
			Macaroon:                arg.Macaroon,
		}},
	}
	if arg.ControllerInfo != nil {
		args.Args[0].ControllerInfo = &params.ExternalControllerInfo{
			ControllerTag: arg.ControllerInfo.ControllerTag.String(),
			Alias:         arg.ControllerInfo.Alias,
			Addrs:         arg.ControllerInfo.Addrs,
			CACert:        arg.ControllerInfo.CACert,
		}
	}
	err := c.facade.FacadeCall("Consume", args, &consumeRes)
	if err != nil {
		return "", errors.Trace(err)
	}
	if resultLen := len(consumeRes.Results); resultLen != 1 {
		return "", errors.Errorf("expected 1 result, got %d", resultLen)
	}
	if err := consumeRes.Results[0].Error; err != nil {
		return "", errors.Trace(err)
	}
	localName := arg.Offer.OfferName
	if arg.ApplicationAlias != "" {
		localName = arg.ApplicationAlias
	}
	return localName, nil
}
// Consume adds a remote application to the model.
Consume adds a remote application to the model.
// Consume adds a remote application to the model .
func (c *Client) Consume(arg crossmodel.ConsumeApplicationArgs) (string, error) {
	var consumeRes params.ErrorResults
	args := params.ConsumeApplicationArgs{
		Args: []params.ConsumeApplicationArg{{
			ApplicationOfferDetails: arg.Offer,
			ApplicationAlias:        arg.ApplicationAlias,
			Macaroon:                arg.Macaroon,
		}},
	}
	if arg.ControllerInfo != nil {
		args.Args[0].ControllerInfo = &params.ExternalControllerInfo{
			ControllerTag: arg.ControllerInfo.ControllerTag.String(),
			Alias:         arg.ControllerInfo.Alias,
			Addrs:         arg.ControllerInfo.Addrs,
			CACert:        arg.ControllerInfo.CACert,
		}
	}
	err := c.facade.FacadeCall("Consume", args, &consumeRes)
	if err != nil {
		return "", errors.Trace(err)
	}
	if resultLen := len(consumeRes.Results); resultLen != 1 {
		return "", errors.Errorf("expected 1 result, got %d", resultLen)
	}
	if err := consumeRes.Results[0].Error; err != nil {
		return "", errors.Trace(err)
	}
	localName := arg.Offer.OfferName
	if arg.ApplicationAlias != "" {
		localName = arg.ApplicationAlias
	}
	return localName, nil
}
func ( c * Client ) Consume ( arg crossmodel . ConsumeApplicationArgs ) ( string , error ) { var consumeRes params . ErrorResults args := params . ConsumeApplicationArgs { Args : [ ] params . ConsumeApplicationArg { { ApplicationOfferDetails : arg . Offer , ApplicationAlias : arg . ApplicationAlias , Macaroon : arg . Macaroon , } } , } if arg . ControllerInfo != nil { args . Args [ 0 ] . ControllerInfo = & params . ExternalControllerInfo { ControllerTag : arg . ControllerInfo . ControllerTag . String ( ) , Alias : arg . ControllerInfo . Alias , Addrs : arg . ControllerInfo . Addrs , CACert : arg . ControllerInfo . CACert , } } err := c . facade . FacadeCall ( " " , args , & consumeRes ) if err != nil { return " " , errors . Trace ( err ) } if resultLen := len ( consumeRes . Results ) ; resultLen != 1 { return " " , errors . Errorf ( " " , resultLen ) } if err := consumeRes . Results [ 0 ] . Error ; err != nil { return " " , errors . Trace ( err ) } localName := arg . Offer . OfferName if arg . ApplicationAlias != " " { localName = arg . ApplicationAlias } return localName , nil }
Consume adds a remote application to the model.
Consume adds a remote application to the model .