<commit_before>// Copyright 2013 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.

package params

import (
	"bytes"
	"encoding/json"
	"fmt"
	"launchpad.net/juju-core/charm"
	"launchpad.net/juju-core/constraints"
	"launchpad.net/juju-core/instance"
)

// Error holds the error result of a single operation.
type Error struct {
	Message string
	Code    string
}

// ErrorCode implements rpc.ErrorCoder interface.
func (e Error) ErrorCode() string {
	return e.Code
}

// Error implements the error interface.
func (e Error) Error() string {
	return e.Message
}

// GoString implements fmt.GoStringer.  It means that a *Error shows its
// contents correctly when printed with %#v.
func (e Error) GoString() string {
	return fmt.Sprintf("&params.Error{%q, %q}", e.Code, e.Message)
}

// ErrorResults holds the results of calling a bulk operation which
// mutates multiple entites, like Machiner.SetStatus. The order and
// number of elements matches the entities specified in the request.
type ErrorResults struct {
	// Errors contains errors occured while performing each operation (if any).
	Errors []*Error
}

// Machines holds the arguments for making an API call working on
// multiple machine entities.
type Machines struct {
	Ids []string
}

// MachineSetStatus holds a machine id, status and extra info.
type MachineSetStatus struct {
	Id     string
	Status Status
	Info   string
}

// MachinesSetStatus holds the parameters for making a Machiner.SetStatus call.
type MachinesSetStatus struct {
	Machines []MachineSetStatus
}

// Generic result type for many APIs that start a watcher
type WatchResult struct {
	WatchId string
	Error   *Error
}

// For APIs that request multiple Watchers be started
type WatchResults struct {
	Results []WatchResult
}

// EntityWatchResult holds an EntityWatcher id and an error (if any).
type EntityWatchResult struct {
	EntityWatcherId string
	Error           *Error
}

// EntityWatchResults holds the results for any API call which ends up
// returning a list of Entity Watchers
type EntityWatchResults struct {
	Results []EntityWatchResult
}

// Agents holds a list of Tags for Unit- and Machine-Agents.
type Agents struct {
	Tags []string
}

// AddRelation holds the parameters for making the AddRelation call.
// The endpoints specified are unordered.
type AddRelation struct {
	Endpoints []string
}

// AddRelationResults holds the results of a AddRelation call. The Endpoints
// field maps service names to the involved endpoints.
type AddRelationResults struct {
	Endpoints map[string]charm.Relation
}

// DestroyRelation holds the parameters for making the DestroyRelation call.
// The endpoints specified are unordered.
type DestroyRelation struct {
	Endpoints []string
}

// Life describes the lifecycle state of an entity ("alive", "dying"
// or "dead").
type Life string

// MachineLifeResult holds the result of Machiner.Life for a single machine.
type MachineLifeResult struct {
	Life  Life<commit_msg>Remove the extraneous params changes.<commit_after>// Copyright 2013 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.

package params

import (
	"bytes"
	"encoding/json"
	"fmt"
	"launchpad.net/juju-core/charm"
	"launchpad.net/juju-core/constraints"
	"launchpad.net/juju-core/instance"
)

// Error holds the error result of a single operation.
type Error struct {
	Message string
	Code    string
}

// ErrorCode implements rpc.ErrorCoder interface.
func (e Error) ErrorCode() string {
	return e.Code
}

// Error implements the error interface.
func (e Error) Error() string {
	return e.Message
}

// GoString implements fmt.GoStringer.  It means that a *Error shows its
// contents correctly when printed with %#v.
func (e Error) GoString() string {
	return fmt.Sprintf("&params.Error{%q, %q}", e.Code, e.Message)
}

// ErrorResults holds the results of calling a bulk operation which
// mutates multiple entites, like Machiner.SetStatus. The order and
// number of elements matches the entities specified in the request.
type ErrorResults struct {
	// Errors contains errors occured while performing each operation (if any).
	Errors []*Error
}

// Machines holds the arguments for making an API call working on
// multiple machine entities.
type Machines struct {
	Ids []string
}

// MachineSetStatus holds a machine id, status and extra info.
type MachineSetStatus struct {
	Id     string
	Status Status
	Info   string
}

// MachinesSetStatus holds the parameters for making a Machiner.SetStatus call.
type MachinesSetStatus struct {
	Machines []MachineSetStatus
}

// EntityWatchResult holds an EntityWatcher id and an error (if any).
type EntityWatchResult struct {
	EntityWatcherId string
	Error           *Error
}

// EntityWatchResults holds the results for any API call which ends up
// returning a list of Entity Watchers
type EntityWatchResults struct {
	Results []EntityWatchResult
}

// AddRelation holds the parameters for making the AddRelation call.
// The endpoints specified are unordered.
type AddRelation struct {
	Endpoints []string
}

// AddRelationResults holds the results of a AddRelation call. The Endpoints
// field maps service names to the involved endpoints.
type AddRelationResults struct {
	Endpoints map[string]charm.Relation
}

// DestroyRelation holds the parameters for making the DestroyRelation call.
// The endpoints specified are unordered.
type DestroyRelation struct {
	Endpoints []string
}

// Life describes the lifecycle state of an entity ("alive", "dying"
// or "dead").
type Life string

// MachineLifeResult holds the result of Machiner.Life for a single machine.
type MachineLifeResult struct {
	Life  Life
{'fraction_non_alphanumeric': 0.07576827975980219, 'fraction_numerical': 0.0017661603673613563, 'mean_word_length': 3.976274165202109, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7558810', 'n_tokens_mistral': 1600, 'n_tokens_neox': 1559, 'n_words': 672}