func (c *Client) DestroyApplications(in DestroyApplicationsParams) ([]params.DestroyApplicationResult, error) {
	argsV5 := params.DestroyApplicationsParams{
		Applications: make([]params.DestroyApplicationParams, 0, len(in.Applications)),
	}
	allResults := make([]params.DestroyApplicationResult, len(in.Applications))
	index := make([]int, 0, len(in.Applications))
	for i, name := range in.Applications {
		if !names.IsValidApplication(name) {
			allResults[i].Error = &params.Error{
				Message: errors.NotValidf("application name %q", name).Error(),
			}
			continue
		}
		index = append(index, i)
		argsV5.Applications = append(argsV5.Applications, params.DestroyApplicationParams{
			ApplicationTag: names.NewApplicationTag(name).String(),
			DestroyStorage: in.DestroyStorage,
			Force:          in.Force,
			MaxWait:        in.MaxWait,
		})
	}
	if len(argsV5.Applications) == 0 {
		return allResults, nil
	}

	args := interface{}(argsV5)
	if c.BestAPIVersion() < 5 {
		if in.DestroyStorage {
			return nil, errors.New("this controller does not support --destroy-storage")
		}
		argsV4 := params.Entities{
			Entities: make([]params.Entity, len(argsV5.Applications)),
		}
		for i, arg := range argsV5.Applications {
			argsV4.Entities[i].Tag = arg.ApplicationTag
		}
		args = argsV4
	}

	var result params.DestroyApplicationResults
	if err := c.facade.FacadeCall("DestroyApplication", args, &result); err != nil {
		return nil, errors.Trace(err)
	}
	if n := len(result.Results); n != len(argsV5.Applications) {
		return nil, errors.Errorf("expected %d result(s), got %d", len(argsV5.Applications), n)
	}
	for i, result := range result.Results {
		allResults[index[i]] = result
	}
	return allResults, nil
}
// DestroyApplications destroys the given applications.
DestroyApplications destroys the given applications.
// DestroyApplications destroys the given applications .
func (c *Client) DestroyApplications(in DestroyApplicationsParams) ([]params.DestroyApplicationResult, error) {
	argsV5 := params.DestroyApplicationsParams{
		Applications: make([]params.DestroyApplicationParams, 0, len(in.Applications)),
	}
	allResults := make([]params.DestroyApplicationResult, len(in.Applications))
	index := make([]int, 0, len(in.Applications))
	for i, name := range in.Applications {
		if !names.IsValidApplication(name) {
			allResults[i].Error = &params.Error{
				Message: errors.NotValidf("application name %q", name).Error(),
			}
			continue
		}
		index = append(index, i)
		argsV5.Applications = append(argsV5.Applications, params.DestroyApplicationParams{
			ApplicationTag: names.NewApplicationTag(name).String(),
			DestroyStorage: in.DestroyStorage,
			Force:          in.Force,
			MaxWait:        in.MaxWait,
		})
	}
	if len(argsV5.Applications) == 0 {
		return allResults, nil
	}
	args := interface{}(argsV5)
	if c.BestAPIVersion() < 5 {
		if in.DestroyStorage {
			return nil, errors.New("this controller does not support --destroy-storage")
		}
		argsV4 := params.Entities{
			Entities: make([]params.Entity, len(argsV5.Applications)),
		}
		for i, arg := range argsV5.Applications {
			argsV4.Entities[i].Tag = arg.ApplicationTag
		}
		args = argsV4
	}
	var result params.DestroyApplicationResults
	if err := c.facade.FacadeCall("DestroyApplication", args, &result); err != nil {
		return nil, errors.Trace(err)
	}
	if n := len(result.Results); n != len(argsV5.Applications) {
		return nil, errors.Errorf("expected %d result(s), got %d", len(argsV5.Applications), n)
	}
	for i, result := range result.Results {
		allResults[index[i]] = result
	}
	return allResults, nil
}
func ( c * Client ) DestroyApplications ( in DestroyApplicationsParams ) ( [ ] params . DestroyApplicationResult , error ) { argsV5 := params . DestroyApplicationsParams { Applications : make ( [ ] params . DestroyApplicationParams , 0 , len ( in . Applications ) ) , } allResults := make ( [ ] params . DestroyApplicationResult , len ( in . Applications ) ) index := make ( [ ] int , 0 , len ( in . Applications ) ) for i , name := range in . Applications { if ! names . IsValidApplication ( name ) { allResults [ i ] . Error = & params . Error { Message : errors . NotValidf ( " " , name ) . Error ( ) , } continue } index = append ( index , i ) argsV5 . Applications = append ( argsV5 . Applications , params . DestroyApplicationParams { ApplicationTag : names . NewApplicationTag ( name ) . String ( ) , DestroyStorage : in . DestroyStorage , Force : in . Force , MaxWait : in . MaxWait , } ) } if len ( argsV5 . Applications ) == 0 { return allResults , nil } args := interface { } ( argsV5 ) if c . BestAPIVersion ( ) < 5 { if in . DestroyStorage { return nil , errors . New ( " " ) } argsV4 := params . Entities { Entities : make ( [ ] params . Entity , len ( argsV5 . Applications ) ) , } for i , arg := range argsV5 . Applications { argsV4 . Entities [ i ] . Tag = arg . ApplicationTag } args = argsV4 } var result params . DestroyApplicationResults if err := c . facade . FacadeCall ( " " , args , & result ) ; err != nil { return nil , errors . Trace ( err ) } if n := len ( result . Results ) ; n != len ( argsV5 . Applications ) { return nil , errors . Errorf ( " " , len ( argsV5 . Applications ) , n ) } for i , result := range result . Results { allResults [ index [ i ] ] = result } return allResults , nil }
DestroyApplications destroys the given applications.
DestroyApplications destroys the given applications .