# Google Cloud Functions V2 Client - Class ServiceConfig (2.1.3)

2.1.3 (latest) 2.1.2 2.0.6 1.7.0 1.6.5 1.5.0 1.4.2 1.3.1 1.2.0 1.1.2 1.0.3 Reference documentation and code samples for the Google Cloud Functions V2 Client class ServiceConfig.

Describes the Service being deployed.

Currently Supported : Cloud Run (fully managed).

Generated from protobuf message `google.cloud.functions.v2.ServiceConfig`

## Namespace

Google \\ Cloud \\ Functions \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ service` | `string` Output only. Name of the service associated with a Function. The format of this field is `projects/{project}/locations/{region}/services/{service}` |
| `↳ timeout_seconds` | `int` The function execution timeout. Execution is considered failed and can be terminated if the function is not completed at the end of the timeout period. Defaults to 60 seconds. |
| `↳ available_memory` | `string` The amount of memory available for a function. Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is supplied the value is interpreted as bytes. See <https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go> a full description. |
| `↳ available_cpu` | `string` The number of CPUs used in a single container instance. Default value is calculated from available memory. Supports the same values as Cloud Run, see <https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements> Example: "1" indicates 1 vCPU |
| `↳ environment_variables` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Environment variables that shall be available during function execution. |
| `↳ max_instance_count` | `int` The limit on the maximum number of function instances that may coexist at a given time. In some cases, such as rapid traffic surges, Cloud Functions may, for a short period of time, create more instances than the specified max instances limit. If your function cannot tolerate this temporary behavior, you may want to factor in a safety margin and set a lower max instances value than your function can tolerate. See the [Max Instances](https://cloud.google.com/functions/docs/max-instances) Guide for more details. |
| `↳ min_instance_count` | `int` The limit on the minimum number of function instances that may coexist at a given time. Function instances are kept in idle state for a short period after they finished executing the request to reduce cold start time for subsequent requests. Setting a minimum instance count will ensure that the given number of instances are kept running in idle state always. This can help with cold start times when jump in incoming request count occurs after the idle instance would have been stopped in the default case. |
| `↳ vpc_connector` | `string` The Serverless VPC Access connector that this cloud function can connect to. The format of this field is `projects/*/locations/*/connectors/*`. |
| `↳ vpc_connector_egress_settings` | `int` The egress settings for the connector, controlling what traffic is diverted through it. |
| `↳ ingress_settings` | `int` The ingress settings for the function, controlling what traffic can reach it. |
| `↳ uri` | `string` Output only. URI of the Service deployed. |
| `↳ service_account_email` | `string` The email of the service's service account. If empty, defaults to `{project_number}-compute\@developer.gserviceaccount.com`. |
| `↳ all_traffic_on_latest_revision` | `bool` Whether 100% of traffic is routed to the latest revision. On CreateFunction and UpdateFunction, when set to true, the revision being deployed will serve 100% of traffic, ignoring any traffic split settings, if any. On GetFunction, true will be returned if the latest revision is serving 100% of traffic. |
| `↳ secret_environment_variables` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.SecretEnvVar>` Secret environment variables configuration. |
| `↳ secret_volumes` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.SecretVolume>` Secret volumes configuration. |
| `↳ revision` | `string` Output only. The name of service revision. |
| `↳ max_instance_request_concurrency` | `int` Sets the maximum number of concurrent requests that each instance can receive. Defaults to 1. |
| `↳ security_level` | `int` Security level configure whether the function only accepts https. This configuration is only applicable to 1st Gen functions with Http trigger. By default https is optional for 1st Gen functions; 2nd Gen functions are https ONLY. |
| `↳ binary_authorization_policy` | `string` Optional. The binary authorization policy to be checked when deploying the Cloud Run service. |

### getService

Output only. Name of the service associated with a Function.

The format of this field is
`projects/{project}/locations/{region}/services/{service}`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setService

Output only. Name of the service associated with a Function.

The format of this field is
`projects/{project}/locations/{region}/services/{service}`

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

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

### getTimeoutSeconds

The function execution timeout. Execution is considered failed and
can be terminated if the function is not completed at the end of the
timeout period. Defaults to 60 seconds.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setTimeoutSeconds

The function execution timeout. Execution is considered failed and
can be terminated if the function is not completed at the end of the
timeout period. Defaults to 60 seconds.

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

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

### getAvailableMemory

The amount of memory available for a function.

Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is
supplied the value is interpreted as bytes.
See
<https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go>
a full description.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setAvailableMemory

The amount of memory available for a function.

Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is
supplied the value is interpreted as bytes.
See
<https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go>
a full description.

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

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

### getAvailableCpu

The number of CPUs used in a single container instance.

Default value is calculated from available memory.
Supports the same values as Cloud Run, see
<https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements>
Example: "1" indicates 1 vCPU

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setAvailableCpu

The number of CPUs used in a single container instance.

Default value is calculated from available memory.
Supports the same values as Cloud Run, see
<https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements>
Example: "1" indicates 1 vCPU

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

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

### getEnvironmentVariables

Environment variables that shall be available during function execution.

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

### setEnvironmentVariables

Environment variables that shall be available during function execution.

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

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

### getMaxInstanceCount

The limit on the maximum number of function instances that may coexist at a
given time.

In some cases, such as rapid traffic surges, Cloud Functions may, for a
short period of time, create more instances than the specified max
instances limit. If your function cannot tolerate this temporary behavior,
you may want to factor in a safety margin and set a lower max instances
value than your function can tolerate.
See the [Max
Instances](https://cloud.google.com/functions/docs/max-instances) Guide for
more details.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setMaxInstanceCount

The limit on the maximum number of function instances that may coexist at a
given time.

In some cases, such as rapid traffic surges, Cloud Functions may, for a
short period of time, create more instances than the specified max
instances limit. If your function cannot tolerate this temporary behavior,
you may want to factor in a safety margin and set a lower max instances
value than your function can tolerate.
See the [Max
Instances](https://cloud.google.com/functions/docs/max-instances) Guide for
more details.

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

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

### getMinInstanceCount

The limit on the minimum number of function instances that may coexist at a
given time.

Function instances are kept in idle state for a short period after they
finished executing the request to reduce cold start time for subsequent
requests. Setting a minimum instance count will ensure that the given
number of instances are kept running in idle state always. This can help
with cold start times when jump in incoming request count occurs after the
idle instance would have been stopped in the default case.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setMinInstanceCount

The limit on the minimum number of function instances that may coexist at a
given time.

Function instances are kept in idle state for a short period after they
finished executing the request to reduce cold start time for subsequent
requests. Setting a minimum instance count will ensure that the given
number of instances are kept running in idle state always. This can help
with cold start times when jump in incoming request count occurs after the
idle instance would have been stopped in the default case.

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

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

### getVpcConnector

The Serverless VPC Access connector that this cloud function can connect
to. The format of this field is `projects/*/locations/*/connectors/*`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setVpcConnector

The Serverless VPC Access connector that this cloud function can connect
to. The format of this field is `projects/*/locations/*/connectors/*`.

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

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

### getVpcConnectorEgressSettings

The egress settings for the connector, controlling what traffic is diverted
through it.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [VpcConnectorEgressSettings](https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.ServiceConfig.VpcConnectorEgressSettings). |

### setVpcConnectorEgressSettings

The egress settings for the connector, controlling what traffic is diverted
through it.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [VpcConnectorEgressSettings](https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.ServiceConfig.VpcConnectorEgressSettings). |

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

### getIngressSettings

The ingress settings for the function, controlling what traffic can reach
it.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [IngressSettings](https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.ServiceConfig.IngressSettings). |

### setIngressSettings

The ingress settings for the function, controlling what traffic can reach
it.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [IngressSettings](https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.ServiceConfig.IngressSettings). |

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

### getUri

Output only. URI of the Service deployed.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setUri

Output only. URI of the Service deployed.

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

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

### getServiceAccountEmail

The email of the service's service account. If empty, defaults to
`{project_number}-compute\@developer.gserviceaccount.com`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setServiceAccountEmail

The email of the service's service account. If empty, defaults to
`{project_number}-compute\@developer.gserviceaccount.com`.

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

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

### getAllTrafficOnLatestRevision

Whether 100% of traffic is routed to the latest revision.

On CreateFunction and UpdateFunction, when set to true, the revision being
deployed will serve 100% of traffic, ignoring any traffic split settings,
if any. On GetFunction, true will be returned if the latest revision is
serving 100% of traffic.

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

### setAllTrafficOnLatestRevision

Whether 100% of traffic is routed to the latest revision.

On CreateFunction and UpdateFunction, when set to true, the revision being
deployed will serve 100% of traffic, ignoring any traffic split settings,
if any. On GetFunction, true will be returned if the latest revision is
serving 100% of traffic.

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

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

### getSecretEnvironmentVariables

Secret environment variables configuration.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.SecretEnvVar>` |   |

### setSecretEnvironmentVariables

Secret environment variables configuration.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.SecretEnvVar>` |

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

### getSecretVolumes

Secret volumes configuration.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.SecretVolume>` |   |

### setSecretVolumes

Secret volumes configuration.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.SecretVolume>` |

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

### getRevision

Output only. The name of service revision.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setRevision

Output only. The name of service revision.

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

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

### getMaxInstanceRequestConcurrency

Sets the maximum number of concurrent requests that each instance
can receive. Defaults to 1.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setMaxInstanceRequestConcurrency

Sets the maximum number of concurrent requests that each instance
can receive. Defaults to 1.

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

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

### getSecurityLevel

Security level configure whether the function only accepts https.

This configuration is only applicable to 1st Gen functions with Http
trigger. By default https is optional for 1st Gen functions; 2nd Gen
functions are https ONLY.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [SecurityLevel](https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.ServiceConfig.SecurityLevel). |

### setSecurityLevel

Security level configure whether the function only accepts https.

This configuration is only applicable to 1st Gen functions with Http
trigger. By default https is optional for 1st Gen functions; 2nd Gen
functions are https ONLY.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [SecurityLevel](https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.ServiceConfig.SecurityLevel). |

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

### getBinaryAuthorizationPolicy

Optional. The binary authorization policy to be checked when deploying the
Cloud Run service.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setBinaryAuthorizationPolicy

Optional. The binary authorization policy to be checked when deploying the
Cloud Run service.

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

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