# Google Cloud Retail V2 Client - Class UpdateProductRequest (2.5.3)

2.5.3 (latest) 2.5.2 2.4.0 2.3.1 2.2.1 2.1.3 2.0.0 1.7.0 1.6.4 1.5.0 1.4.2 1.3.1 1.2.1 1.1.1 1.0.1 Reference documentation and code samples for the Google Cloud Retail V2 Client class UpdateProductRequest.

Request message for
[ProductService.UpdateProduct](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__updateProduct__)
method.

Generated from protobuf message `google.cloud.retail.v2.UpdateProductRequest`

## Namespace

Google \\ Cloud \\ Retail \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ product` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product` Required. The product to update/create. If the caller does not have permission to update the [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product), regardless of whether or not it exists, a PERMISSION_DENIED error is returned. If the [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) to update does not exist and [allow_missing](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.UpdateProductRequest#_Google_Cloud_Retail_V2_UpdateProductRequest__getAllowMissing__) is not set, a NOT_FOUND error is returned. |
| `↳ update_mask` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/FieldMask` Indicates which fields in the provided [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) to update. The immutable and output only fields are NOT supported. If not set, all supported fields (the fields that are neither immutable nor output only) are updated. If an unsupported or unknown field is provided, an INVALID_ARGUMENT error is returned. The attribute key can be updated by setting the mask path as "attributes.${key_name}". If a key name is present in the mask but not in the patching product from the request, this key will be deleted after the update. |
| `↳ allow_missing` | `bool` If set to true, and the [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) is not found, a new [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) will be created. In this situation, `update_mask` is ignored. |

### getProduct

Required. The product to update/create.

If the caller does not have permission to update the
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product), regardless of whether or not it
exists, a PERMISSION_DENIED error is returned.
If the [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) to update does not exist
and
[allow_missing](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.UpdateProductRequest#_Google_Cloud_Retail_V2_UpdateProductRequest__getAllowMissing__)
is not set, a NOT_FOUND error is returned.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product|null` |   |

### hasProduct

### clearProduct

### setProduct

Required. The product to update/create.

If the caller does not have permission to update the
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product), regardless of whether or not it
exists, a PERMISSION_DENIED error is returned.
If the [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) to update does not exist
and
[allow_missing](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.UpdateProductRequest#_Google_Cloud_Retail_V2_UpdateProductRequest__getAllowMissing__)
is not set, a NOT_FOUND error is returned.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getUpdateMask

Indicates which fields in the provided
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) to update. The immutable and
output only fields are NOT supported. If not set, all supported fields (the
fields that are neither immutable nor output only) are updated.

If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
is returned.
The attribute key can be updated by setting the mask path as
"attributes.${key_name}". If a key name is present in the mask but not in
the patching product from the request, this key will be deleted after the
update.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/FieldMask|null` |   |

### hasUpdateMask

### clearUpdateMask

### setUpdateMask

Indicates which fields in the provided
[Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) to update. The immutable and
output only fields are NOT supported. If not set, all supported fields (the
fields that are neither immutable nor output only) are updated.

If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
is returned.
The attribute key can be updated by setting the mask path as
"attributes.${key_name}". If a key name is present in the mask but not in
the patching product from the request, this key will be deleted after the
update.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/FieldMask` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAllowMissing

If set to true, and the [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) is not
found, a new [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) will be created. In
this situation, `update_mask` is ignored.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setAllowMissing

If set to true, and the [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) is not
found, a new [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) will be created. In
this situation, `update_mask` is ignored.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### static::build

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `product` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product` Required. The product to update/create. If the caller does not have permission to update the [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product), regardless of whether or not it exists, a PERMISSION_DENIED error is returned. If the [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) to update does not exist and [allow_missing](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.UpdateProductRequest#_Google_Cloud_Retail_V2_UpdateProductRequest__getAllowMissing__) is not set, a NOT_FOUND error is returned. |
| `updateMask` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/FieldMask` Indicates which fields in the provided [Product](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Product) to update. The immutable and output only fields are NOT supported. If not set, all supported fields (the fields that are neither immutable nor output only) are updated. If an unsupported or unknown field is provided, an INVALID_ARGUMENT error is returned. The attribute key can be updated by setting the mask path as "attributes.${key_name}". If a key name is present in the mask but not in the patching product from the request, this key will be deleted after the update. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.UpdateProductRequest` |   |