NOTE: For Version 3 of the AWS SDK for PHP, please see the V3 User Guide and V3 API Reference.

# Class Operation

Data object holding the information of an API command

  Guzzle\Service\Description\Operation implements Guzzle\Service\Description\OperationInterface

Namespace: Guzzle\Service\Description
Located at Guzzle/Service/Description/Operation.php

## Methods summary

- `public` `__construct ( array $config = array(), Guzzle\Service\Description\ServiceDescriptionInterface $description = null )`

  Builds an Operation object using an array of configuration data:

  - name: (string) Name of the command
  - httpMethod: (string) HTTP method of the operation
  - uri: (string) URI template that can create a relative or absolute URL
  - class: (string) Concrete class that implements this command
  - parameters: (array) Associative array of parameters for the command. `Guzzle\Service\Description\Parameter` for information.
  - summary: (string) This is a short summary of what the operation does
  - notes: (string) A longer text field to explain the behavior of the operation.
  - documentationUrl: (string) Reference URL providing more information about the operation
  - responseClass: (string) This is what is returned from the method. Can be a primitive, PSR-0 compliant

    class name, or model.

  - responseNotes: (string) Information about the response returned by the operation
  - responseType: (string) One of 'primitive', 'class', 'model', or 'documentation'. If not specified, this

    value will be automatically inferred based on whether or not there is a model matching the

    name, if a matching PSR-0 compliant class name is found, or set to 'primitive' by default.

  - deprecated: (bool) Set to true if this is a deprecated command
  - errorResponses: (array) Errors that could occur when executing the command. Array of hashes, each with a

    'code' (the HTTP response code), 'reason' (response reason phrase or description of the

    error), and 'class' (a custom exception class that would be thrown if the error is

    encountered).

  - data: (array) Any extra data that might be used to help build or serialize the operation
  - additionalParameters: (null|array) Parameter schema to use when an option is passed to the operation that is

    not in the schema

- `public` `toArray ( )`

  Get the array representation of an object

- `public` `getServiceDescription ( )`

  Get the service description that the operation belongs to

- `public` `setServiceDescription ( Guzzle\Service\Description\ServiceDescriptionInterface $description )`

  Set the service description that the operation belongs to

- `public` `getParams ( )`

  Get the params of the operation

- `public` `getParamNames ( )`

  Returns an array of parameter names

- `public` `hasParam ( string $name )`

  Check if the operation has a specific parameter by name

- `public` `getParam ( string $param )`

  Get a single parameter of the operation

- `public` `addParam ( Guzzle\Service\Description\Parameter $param )`

  Add a parameter to the command

- `public` `removeParam ( string $name )`

  Remove a parameter from the command

- `public` `getHttpMethod ( )`

  Get the HTTP method of the operation

- `public` `setHttpMethod ( string $httpMethod )`

  Set the HTTP method of the command

- `public` `getClass ( )`

  Get the concrete operation class that implements this operation

- `public` `setClass ( string $className )`

  Set the concrete class of the command

- `public` `getName ( )`

  Get the name of the operation

- `public` `setName ( string $name )`

  Set the name of the command

- `public` `getSummary ( )`

  Get a short summary of what the operation does

- `public` `setSummary ( string $summary )`

  Set a short summary of what the operation does

- `public` `getNotes ( )`

  Get a longer text field to explain the behavior of the operation

- `public` `setNotes ( string $notes )`

  Set a longer text field to explain the behavior of the operation.

- `public` `getDocumentationUrl ( )`

  Get the documentation URL of the operation

- `public` `setDocumentationUrl ( string $docUrl )`

  Set the URL pointing to additional documentation on the command

- `public` `getResponseClass ( )`

  Get what is returned from the method. Can be a primitive, class name, or model. For example, the responseClass could be 'array', which would inherently use a responseType of 'primitive'. Using a class name would set a responseType of 'class'. Specifying a model by ID will use a responseType of 'model'.

- `public` `setResponseClass ( string $responseClass )`

  Set what is returned from the method. Can be a primitive, class name, or model. For example: 'array', 'Guzzle\\Foo\\Baz', or 'MyModelName' (to reference a model by ID).

- `public` `getResponseType ( )`

  Get information about how the response is unmarshalled: One of 'primitive', 'class', 'model', or 'documentation'

- `public` `setResponseType ( string $responseType )`

  Set qualifying information about the responseClass. One of 'primitive', 'class', 'model', or 'documentation'

- `public` `getResponseNotes ( )`

  Get notes about the response of the operation

- `public` `setResponseNotes ( string $notes )`

  Set notes about the response of the operation

- `public` `getDeprecated ( )`

  Get whether or not the operation is deprecated

- `public` `setDeprecated ( bool $isDeprecated )`

  Set whether or not the command is deprecated

- `public` `getUri ( )`

  Get the URI that will be merged into the generated request

- `public` `setUri ( string $uri )`

  Set the URI template of the command

- `public` `getErrorResponses ( )`

  Get the errors that could be encountered when executing the operation

- `public` `addErrorResponse ( string $code, string $reason, string $class )`

  Add an error to the command

- `public` `setErrorResponses ( array $errorResponses )`

  Set all of the error responses of the operation

- `public` `getData ( string $name )`

  Get extra data from the operation

- `public` `setData ( string $name, mixed $value )`

  Set a particular data point on the operation

- `public` `getAdditionalParameters ( )`

  Get the additionalParameters of the operation

- `public` `setAdditionalParameters ( Parameter|null $parameter )`

  Set the additionalParameters of the operation

- `protected` `inferResponseType ( )`

  Infer the response type from the responseClass value

## Methods detail

# `public`
`__construct( array $config = array(), `Guzzle\Service\Description\ServiceDescriptionInterface` $description = null )`

Builds an Operation object using an array of configuration data:

- name: (string) Name of the command
- httpMethod: (string) HTTP method of the operation
- uri: (string) URI template that can create a relative or absolute URL
- class: (string) Concrete class that implements this command
- parameters: (array) Associative array of parameters for the command. `Guzzle\Service\Description\Parameter` for information.
- summary: (string) This is a short summary of what the operation does
- notes: (string) A longer text field to explain the behavior of the operation.
- documentationUrl: (string) Reference URL providing more information about the operation
- responseClass: (string) This is what is returned from the method. Can be a primitive, PSR-0 compliant class name, or model.
- responseNotes: (string) Information about the response returned by the operation
- responseType: (string) One of 'primitive', 'class', 'model', or 'documentation'. If not specified, this value will be automatically inferred based on whether or not there is a model matching the name, if a matching PSR-0 compliant class name is found, or set to 'primitive' by default.
- deprecated: (bool) Set to true if this is a deprecated command
- errorResponses: (array) Errors that could occur when executing the command. Array of hashes, each with a 'code' (the HTTP response code), 'reason' (response reason phrase or description of the error), and 'class' (a custom exception class that would be thrown if the error is encountered).
- data: (array) Any extra data that might be used to help build or serialize the operation
- additionalParameters: (null|array) Parameter schema to use when an option is passed to the operation that is not in the schema

#### Parameters

$config
  `array`
  $config Array of configuration data
$description
  ``Guzzle\Service\Description\ServiceDescriptionInterface``
  $description Service description used to resolve models if $ref tags are found

# `public array`
`toArray( )`

Get the array representation of an object

#### Returns

`array`

#### Implementation of

`Guzzle\Common\ToArrayInterface::toArray()`
# `public `Guzzle\Service\Description\ServiceDescriptionInterface`|null`
`getServiceDescription( )`

Get the service description that the operation belongs to

#### Returns

``Guzzle\Service\Description\ServiceDescriptionInterface`|null`

#### Implementation of

`Guzzle\Service\Description\OperationInterface::getServiceDescription()`
# `public `Guzzle\Service\Description\Operation``
`setServiceDescription( `Guzzle\Service\Description\ServiceDescriptionInterface` $description )`

Set the service description that the operation belongs to

#### Parameters

$description
  ``Guzzle\Service\Description\ServiceDescriptionInterface``
  $description Service description

#### Returns

``Guzzle\Service\Description\Operation``

#### Implementation of

`Guzzle\Service\Description\OperationInterface::setServiceDescription()`
# `public array`
`getParams( )`

Get the params of the operation

#### Returns

`array`

#### Implementation of

`Guzzle\Service\Description\OperationInterface::getParams()`
# `public array`
`getParamNames( )`

Returns an array of parameter names

#### Returns

`array`

#### Implementation of

`Guzzle\Service\Description\OperationInterface::getParamNames()`
# `public boolean`
`hasParam( string $name )`

Check if the operation has a specific parameter by name

#### Parameters

$name
  `string`
  $name Name of the param

#### Returns

`boolean`

#### Implementation of

`Guzzle\Service\Description\OperationInterface::hasParam()`
# `public `Guzzle\Service\Description\Parameter`|null`
`getParam( string $param )`

Get a single parameter of the operation

#### Parameters

$param
  `string`
  $param Parameter to retrieve by name

#### Returns

``Guzzle\Service\Description\Parameter`|null`

#### Implementation of

`Guzzle\Service\Description\OperationInterface::getParam()`
# `public `Guzzle\Service\Description\Operation``
`addParam( `Guzzle\Service\Description\Parameter` $param )`

Add a parameter to the command

#### Parameters

$param
  ``Guzzle\Service\Description\Parameter``
  $param Parameter to add

#### Returns

``Guzzle\Service\Description\Operation``
# `public `Guzzle\Service\Description\Operation``
`removeParam( string $name )`

Remove a parameter from the command

#### Parameters

$name
  `string`
  $name Name of the parameter to remove

#### Returns

``Guzzle\Service\Description\Operation``
# `public string|null`
`getHttpMethod( )`

Get the HTTP method of the operation

#### Returns

`string|null`

#### Implementation of

`Guzzle\Service\Description\OperationInterface::getHttpMethod()`
# `public `Guzzle\Service\Description\Operation``
`setHttpMethod( string $httpMethod )`

Set the HTTP method of the command

#### Parameters

$httpMethod
  `string`
  $httpMethod Method to set

#### Returns

``Guzzle\Service\Description\Operation``
# `public string`
`getClass( )`

Get the concrete operation class that implements this operation

#### Returns

`string`

#### Implementation of

`Guzzle\Service\Description\OperationInterface::getClass()`
# `public `Guzzle\Service\Description\Operation``
`setClass( string $className )`

Set the concrete class of the command

#### Parameters

$className
  `string`
  $className Concrete class name

#### Returns

``Guzzle\Service\Description\Operation``
# `public string|null`
`getName( )`

Get the name of the operation

#### Returns

`string|null`

#### Implementation of

`Guzzle\Service\Description\OperationInterface::getName()`
# `public `Guzzle\Service\Description\Operation``
`setName( string $name )`

Set the name of the command

#### Parameters

$name
  `string`
  $name Name of the command

#### Returns

``Guzzle\Service\Description\Operation``
# `public string|null`
`getSummary( )`

Get a short summary of what the operation does

#### Returns

`string|null`

#### Implementation of

`Guzzle\Service\Description\OperationInterface::getSummary()`
# `public `Guzzle\Service\Description\Operation``
`setSummary( string $summary )`

Set a short summary of what the operation does

#### Parameters

$summary
  `string`
  $summary Short summary of the operation

#### Returns

``Guzzle\Service\Description\Operation``
# `public string|null`
`getNotes( )`

Get a longer text field to explain the behavior of the operation

#### Returns

`string|null`

#### Implementation of

`Guzzle\Service\Description\OperationInterface::getNotes()`
# `public `Guzzle\Service\Description\Operation``
`setNotes( string $notes )`

Set a longer text field to explain the behavior of the operation.

#### Parameters

$notes
  `string`
  $notes Notes on the operation

#### Returns

``Guzzle\Service\Description\Operation``
# `public string|null`
`getDocumentationUrl( )`

Get the documentation URL of the operation

#### Returns

`string|null`

#### Implementation of

`Guzzle\Service\Description\OperationInterface::getDocumentationUrl()`
# `public `Guzzle\Service\Description\Operation``
`setDocumentationUrl( string $docUrl )`

Set the URL pointing to additional documentation on the command

#### Parameters

$docUrl
  `string`
  $docUrl Documentation URL

#### Returns

``Guzzle\Service\Description\Operation``
# `public string|null`
`getResponseClass( )`

Get what is returned from the method. Can be a primitive, class name, or model. For example, the responseClass could be 'array', which would inherently use a responseType of 'primitive'. Using a class name would set a responseType of 'class'. Specifying a model by ID will use a responseType of 'model'.

#### Returns

`string|null`

#### Implementation of

`Guzzle\Service\Description\OperationInterface::getResponseClass()`
# `public `Guzzle\Service\Description\Operation``
`setResponseClass( string $responseClass )`

Set what is returned from the method. Can be a primitive, class name, or model. For example: 'array', 'Guzzle\\Foo\\Baz', or 'MyModelName' (to reference a model by ID).

#### Parameters

$responseClass
  `string`
  $responseClass Type of response

#### Returns

``Guzzle\Service\Description\Operation``
# `public string`
`getResponseType( )`

Get information about how the response is unmarshalled: One of 'primitive', 'class', 'model', or 'documentation'

#### Returns

`string`

#### Implementation of

`Guzzle\Service\Description\OperationInterface::getResponseType()`
# `public `Guzzle\Service\Description\Operation``
`setResponseType( string $responseType )`

Set qualifying information about the responseClass. One of 'primitive', 'class', 'model', or 'documentation'

#### Parameters

$responseType
  `string`
  $responseType Response type information

#### Returns

``Guzzle\Service\Description\Operation``

#### Throws

``Guzzle\Common\Exception\InvalidArgumentException``
# `public string|null`
`getResponseNotes( )`

Get notes about the response of the operation

#### Returns

`string|null`

#### Implementation of

`Guzzle\Service\Description\OperationInterface::getResponseNotes()`
# `public `Guzzle\Service\Description\Operation``
`setResponseNotes( string $notes )`

Set notes about the response of the operation

#### Parameters

$notes
  `string`
  $notes Response notes

#### Returns

``Guzzle\Service\Description\Operation``
# `public boolean`
`getDeprecated( )`

Get whether or not the operation is deprecated

#### Returns

`boolean`

#### Implementation of

`Guzzle\Service\Description\OperationInterface::getDeprecated()`
# `public `Guzzle\Service\Description\Operation``
`setDeprecated( boolean $isDeprecated )`

Set whether or not the command is deprecated

#### Parameters

$isDeprecated
  `boolean`
  $isDeprecated Set to true to mark as deprecated

#### Returns

``Guzzle\Service\Description\Operation``
# `public string`
`getUri( )`

Get the URI that will be merged into the generated request

#### Returns

`string`

#### Implementation of

`Guzzle\Service\Description\OperationInterface::getUri()`
# `public `Guzzle\Service\Description\Operation``
`setUri( string $uri )`

Set the URI template of the command

#### Parameters

$uri
  `string`
  $uri URI template to set

#### Returns

``Guzzle\Service\Description\Operation``
# `public array`
`getErrorResponses( )`

Get the errors that could be encountered when executing the operation

#### Returns

`array`

#### Implementation of

`Guzzle\Service\Description\OperationInterface::getErrorResponses()`
# `public `Guzzle\Service\Description\Operation``
`addErrorResponse( string $code, string $reason, string $class )`

Add an error to the command

#### Parameters

$code
  `string`
  $code HTTP response code
$reason
  `string`
  $reason HTTP response reason phrase or information about the error
$class
  `string`
  $class Exception class associated with the error

#### Returns

``Guzzle\Service\Description\Operation``
# `public `Guzzle\Service\Description\Operation``
`setErrorResponses( array $errorResponses )`

Set all of the error responses of the operation

#### Parameters

$errorResponses
  `array`
  $errorResponses Hash of error name to a hash containing a code, reason, class

#### Returns

``Guzzle\Service\Description\Operation``
# `public mixed|null`
`getData( string $name )`

Get extra data from the operation

#### Parameters

$name
  `string`
  $name Name of the data point to retrieve

#### Returns

`mixed|null`

#### Implementation of

`Guzzle\Service\Description\OperationInterface::getData()`
# `public `Guzzle\Service\Description\Operation``
`setData( string $name, mixed $value )`

Set a particular data point on the operation

#### Parameters

$name
  `string`
  $name Name of the data value
$value
  `mixed`
  $value Value to set

#### Returns

``Guzzle\Service\Description\Operation``
# `public `Guzzle\Service\Description\Parameter`|null`
`getAdditionalParameters( )`

Get the additionalParameters of the operation

#### Returns

``Guzzle\Service\Description\Parameter`|null`
# `public `Guzzle\Service\Description\Operation``
`setAdditionalParameters( `Guzzle\Service\Description\Parameter`|null $parameter )`

Set the additionalParameters of the operation

#### Parameters

$parameter
  ``Guzzle\Service\Description\Parameter`|null`
  $parameter Parameter to set

#### Returns

``Guzzle\Service\Description\Operation``
# `protected`
`inferResponseType( )`

Infer the response type from the responseClass value

### Magic methods summary

## Constants summary

`string` | `DEFAULT_COMMAND_CLASS` | `'Guzzle\\Service\\Command\\OperationCommand'` | # Default command class to use when none is specified

### Constants inherited from Guzzle\Service\Description\OperationInterface

`TYPE_CLASS`, `TYPE_DOCUMENTATION`, `TYPE_MODEL`, `TYPE_PRIMITIVE`

## Properties summary

`protected static array` | $properties | # Hashmap of properties that can be specified. Represented as a hash to speed up constructor.
`protected array` | $parameters | # Parameters
`protected `Guzzle\Service\Description\Parameter`` | $additionalParameters | # Additional parameters schema
`protected string` | $name | # Name of the command
`protected string` | $httpMethod | # HTTP method
`protected string` | $summary | # This is a short summary of what the operation does
`protected string` | $notes | # A longer text field to explain the behavior of the operation.
`protected string` | $documentationUrl | # Reference URL providing more information about the operation
`protected string` | $uri | # HTTP URI of the command
`protected string` | $class | # Class of the command object
`protected string` | $responseClass | # This is what is returned from the method
`protected string` | $responseType | # Type information about the response
`protected string` | $responseNotes | # Information about the response returned by the operation
`protected boolean` | $deprecated | # Whether or not the command is deprecated
`protected array` | $errorResponses | # Array of errors that could occur when running the command
`protected `Guzzle\Service\Description\ServiceDescriptionInterface`` | $description | #
`protected array` | $data | # Extra operation information