On January 1, 2020 this library will no longer support Python 2 on the latest released version. Previously released library versions will continue to be available. For more information please visit Python 2 support on Google Cloud.

Client for Google Container Engine API

class google.cloud.container_v1.ClusterManagerClient(transport=None, channel=None, credentials=None, client_config=None, client_info=None, client_options=None)[source]

Google Kubernetes Engine Cluster Manager v1

Constructor.

Parameters
  • (Union[ClusterManagerGrpcTransport, (transport) – Callable[[~.Credentials, type], ~.ClusterManagerGrpcTransport]): A transport instance, responsible for actually making the API calls. The default transport uses the gRPC protocol. This argument may also be a callable which returns a transport instance. Callables will be sent the credentials as the first argument and the default transport class as the second argument.

  • channel (grpc.Channel) – DEPRECATED. A Channel instance through which to make calls. This argument is mutually exclusive with credentials; providing both will raise an exception.

  • credentials (google.auth.credentials.Credentials) – The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. This argument is mutually exclusive with providing a transport instance to transport; doing so will raise an exception.

  • client_config (dict) – DEPRECATED. A dictionary of call options for each method. If not specified, the default configuration is used.

  • client_info (google.api_core.gapic_v1.client_info.ClientInfo) – The client info used to send a user-agent string along with API requests. If None, then default info will be used. Generally, you only need to set this if you’re developing your own client library.

  • client_options (Union[dict, google.api_core.client_options.ClientOptions]) – Client options used to set user options on the client. API Endpoint should be set through client_options.

cancel_operation(project_id=None, zone=None, operation_id=None, name=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Cancels the specified operation.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> client.cancel_operation()
Parameters
  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the operation resides. This field has been deprecated and replaced by the name field.

  • operation_id (str) – Deprecated. The server-assigned name of the operation. This field has been deprecated and replaced by the name field.

  • name (str) – The name (project, location, operation id) of the operation to cancel. Specified in the format projects/*/locations/*/operations/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Raises
complete_i_p_rotation(project_id=None, zone=None, cluster_id=None, name=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Completes master IP rotation.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> response = client.complete_i_p_rotation()
Parameters
  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

  • cluster_id (str) – Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.

  • name (str) – The name (project, location, cluster id) of the cluster to complete IP rotation. Specified in the format projects/*/locations/*/clusters/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Operation instance.

Raises
create_cluster(cluster, project_id=None, zone=None, parent=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Creates a cluster, consisting of the specified number and type of Google Compute Engine instances.

By default, the cluster is created in the project’s default network.

One firewall is added for the cluster. After cluster creation, the Kubelet creates routes for each node to allow the containers on that node to communicate with all other instances in the cluster.

Finally, an entry is added to the project’s global metadata indicating which CIDR range the cluster is using.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> # TODO: Initialize `cluster`:
>>> cluster = {}
>>>
>>> response = client.create_cluster(cluster)
Parameters
  • cluster (Union[dict, Cluster]) –

    Required. A cluster resource

    If a dict is provided, it must be of the same form as the protobuf message Cluster

  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the parent field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the parent field.

  • parent (str) – The parent (project and location) where the cluster will be created. Specified in the format projects/*/locations/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Operation instance.

Raises
create_node_pool(node_pool, project_id=None, zone=None, cluster_id=None, parent=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Creates a node pool for a cluster.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> # TODO: Initialize `node_pool`:
>>> node_pool = {}
>>>
>>> response = client.create_node_pool(node_pool)
Parameters
  • node_pool (Union[dict, NodePool]) –

    Required. The node pool to create.

    If a dict is provided, it must be of the same form as the protobuf message NodePool

  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the parent field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the parent field.

  • cluster_id (str) – Deprecated. The name of the cluster. This field has been deprecated and replaced by the parent field.

  • parent (str) – The parent (project, location, cluster id) where the node pool will be created. Specified in the format projects/*/locations/*/clusters/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Operation instance.

Raises
delete_cluster(project_id=None, zone=None, cluster_id=None, name=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Deletes the cluster, including the Kubernetes endpoint and all worker nodes.

Firewalls and routes that were configured during cluster creation are also deleted.

Other Google Compute Engine resources that might be in use by the cluster, such as load balancer resources, are not deleted if they weren’t present when the cluster was initially created.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> response = client.delete_cluster()
Parameters
  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

  • cluster_id (str) – Deprecated. The name of the cluster to delete. This field has been deprecated and replaced by the name field.

  • name (str) – The name (project, location, cluster) of the cluster to delete. Specified in the format projects/*/locations/*/clusters/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Operation instance.

Raises
delete_node_pool(project_id=None, zone=None, cluster_id=None, node_pool_id=None, name=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Deletes a node pool from a cluster.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> response = client.delete_node_pool()
Parameters
  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

  • cluster_id (str) – Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.

  • node_pool_id (str) – Deprecated. The name of the node pool to delete. This field has been deprecated and replaced by the name field.

  • name (str) – The name (project, location, cluster, node pool id) of the node pool to delete. Specified in the format projects/*/locations/*/clusters/*/nodePools/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Operation instance.

Raises
enums = <module 'google.cloud.container_v1.gapic.enums' from '/tmpfs/src/github/python-container/google/cloud/container_v1/gapic/enums.py'>
classmethod from_service_account_file(filename, *args, **kwargs)[source]

Creates an instance of this client using the provided credentials file.

Parameters
  • filename (str) – The path to the service account private key json file.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

ClusterManagerClient

classmethod from_service_account_json(filename, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameters
  • filename (str) – The path to the service account private key json file.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

ClusterManagerClient

get_cluster(project_id=None, zone=None, cluster_id=None, name=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Gets the details of a specific cluster.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> response = client.get_cluster()
Parameters
  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

  • cluster_id (str) – Deprecated. The name of the cluster to retrieve. This field has been deprecated and replaced by the name field.

  • name (str) – The name (project, location, cluster) of the cluster to retrieve. Specified in the format projects/*/locations/*/clusters/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Cluster instance.

Raises
get_node_pool(project_id=None, zone=None, cluster_id=None, node_pool_id=None, name=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Retrieves the requested node pool.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> response = client.get_node_pool()
Parameters
  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

  • cluster_id (str) – Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.

  • node_pool_id (str) – Deprecated. The name of the node pool. This field has been deprecated and replaced by the name field.

  • name (str) – The name (project, location, cluster, node pool id) of the node pool to get. Specified in the format projects/*/locations/*/clusters/*/nodePools/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A NodePool instance.

Raises
get_operation(project_id=None, zone=None, operation_id=None, name=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Gets the specified operation.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> response = client.get_operation()
Parameters
  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

  • operation_id (str) – Deprecated. The server-assigned name of the operation. This field has been deprecated and replaced by the name field.

  • name (str) – The name (project, location, operation id) of the operation to get. Specified in the format projects/*/locations/*/operations/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Operation instance.

Raises
get_server_config(project_id=None, zone=None, name=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Returns configuration info about the Google Kubernetes Engine service.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> response = client.get_server_config()
Parameters
  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone to return operations for. This field has been deprecated and replaced by the name field.

  • name (str) – The name (project and location) of the server config to get, specified in the format projects/*/locations/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A ServerConfig instance.

Raises
list_clusters(project_id=None, zone=None, parent=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Lists all clusters owned by a project in either the specified zone or all zones.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> response = client.list_clusters()
Parameters
  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the parent field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides, or “-” for all zones. This field has been deprecated and replaced by the parent field.

  • parent (str) – The parent (project and location) where the clusters will be listed. Specified in the format projects/*/locations/*. Location “-” matches all zones and all regions.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A ListClustersResponse instance.

Raises
list_node_pools(project_id=None, zone=None, cluster_id=None, parent=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Lists the node pools for a cluster.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> response = client.list_node_pools()
Parameters
  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the parent field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the parent field.

  • cluster_id (str) – Deprecated. The name of the cluster. This field has been deprecated and replaced by the parent field.

  • parent (str) – The parent (project, location, cluster id) where the node pools will be listed. Specified in the format projects/*/locations/*/clusters/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A ListNodePoolsResponse instance.

Raises
list_operations(project_id=None, zone=None, parent=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Lists all operations in a project in a specific zone or all zones.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> response = client.list_operations()
Parameters
  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the parent field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone to return operations for, or - for all zones. This field has been deprecated and replaced by the parent field.

  • parent (str) – The parent (project and location) where the operations will be listed. Specified in the format projects/*/locations/*. Location “-” matches all zones and all regions.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A ListOperationsResponse instance.

Raises
list_usable_subnetworks(parent=None, filter_=None, page_size=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Lists subnetworks that are usable for creating clusters in a project.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> # Iterate over all results
>>> for element in client.list_usable_subnetworks():
...     # process element
...     pass
>>>
>>>
>>> # Alternatively:
>>>
>>> # Iterate over results one page at a time
>>> for page in client.list_usable_subnetworks().pages:
...     for element in page:
...         # process element
...         pass
Parameters
  • parent (str) – The parent project where subnetworks are usable. Specified in the format projects/*.

  • filter_ (str) – Filtering currently only supports equality on the networkProjectId and must be in the form: “networkProjectId=[PROJECTID]”, where networkProjectId is the project which owns the listed subnetworks. This defaults to the parent project ID.

  • page_size (int) – The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A PageIterator instance. An iterable of UsableSubnetwork instances. You can also iterate over the pages of the response using its pages property.

Raises
rollback_node_pool_upgrade(project_id=None, zone=None, cluster_id=None, node_pool_id=None, name=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Rolls back a previously Aborted or Failed NodePool upgrade. This makes no changes if the last upgrade successfully completed.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> response = client.rollback_node_pool_upgrade()
Parameters
  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

  • cluster_id (str) – Deprecated. The name of the cluster to rollback. This field has been deprecated and replaced by the name field.

  • node_pool_id (str) – Deprecated. The name of the node pool to rollback. This field has been deprecated and replaced by the name field.

  • name (str) – The name (project, location, cluster, node pool id) of the node poll to rollback upgrade. Specified in the format projects/*/locations/*/clusters/*/nodePools/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Operation instance.

Raises
set_addons_config(addons_config, project_id=None, zone=None, cluster_id=None, name=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Sets the addons for a specific cluster.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> # TODO: Initialize `addons_config`:
>>> addons_config = {}
>>>
>>> response = client.set_addons_config(addons_config)
Parameters
  • addons_config (Union[dict, AddonsConfig]) –

    Required. The desired configurations for the various addons available to run in the cluster.

    If a dict is provided, it must be of the same form as the protobuf message AddonsConfig

  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

  • cluster_id (str) – Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.

  • name (str) – The name (project, location, cluster) of the cluster to set addons. Specified in the format projects/*/locations/*/clusters/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Operation instance.

Raises
set_labels(resource_labels, label_fingerprint, project_id=None, zone=None, cluster_id=None, name=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Sets labels on a cluster.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> # TODO: Initialize `resource_labels`:
>>> resource_labels = {}
>>>
>>> # TODO: Initialize `label_fingerprint`:
>>> label_fingerprint = ''
>>>
>>> response = client.set_labels(resource_labels, label_fingerprint)
Parameters
  • resource_labels (dict[str -> str]) – Required. The labels to set for that cluster.

  • label_fingerprint (str) – Required. The fingerprint of the previous set of labels for this resource, used to detect conflicts. The fingerprint is initially generated by Kubernetes Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash when updating or changing labels. Make a <code>get()</code> request to the resource to get the latest fingerprint.

  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

  • cluster_id (str) – Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.

  • name (str) – The name (project, location, cluster id) of the cluster to set labels. Specified in the format projects/*/locations/*/clusters/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Operation instance.

Raises
set_legacy_abac(enabled, project_id=None, zone=None, cluster_id=None, name=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Enables or disables the ABAC authorization mechanism on a cluster.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> # TODO: Initialize `enabled`:
>>> enabled = False
>>>
>>> response = client.set_legacy_abac(enabled)
Parameters
  • enabled (bool) – Required. Whether ABAC authorization will be enabled in the cluster.

  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

  • cluster_id (str) – Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.

  • name (str) – The name (project, location, cluster id) of the cluster to set legacy abac. Specified in the format projects/*/locations/*/clusters/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Operation instance.

Raises
set_locations(locations, project_id=None, zone=None, cluster_id=None, name=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Sets the locations for a specific cluster.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> # TODO: Initialize `locations`:
>>> locations = []
>>>
>>> response = client.set_locations(locations)
Parameters
  • locations (list[str]) –

    Required. The desired list of Google Compute Engine zones in which the cluster’s nodes should be located. Changing the locations a cluster is in will result in nodes being either created or removed from the cluster, depending on whether locations are being added or removed.

    This list must always include the cluster’s primary zone.

  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

  • cluster_id (str) – Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.

  • name (str) – The name (project, location, cluster) of the cluster to set locations. Specified in the format projects/*/locations/*/clusters/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Operation instance.

Raises
set_logging_service(logging_service, project_id=None, zone=None, cluster_id=None, name=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Sets the logging service for a specific cluster.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> # TODO: Initialize `logging_service`:
>>> logging_service = ''
>>>
>>> response = client.set_logging_service(logging_service)
Parameters
  • logging_service (str) –

    Required. The logging service the cluster should use to write metrics. Currently available options:

    • ”logging.googleapis.com” - the Google Cloud Logging service

    • ”none” - no metrics will be exported from the cluster

  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

  • cluster_id (str) – Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.

  • name (str) – The name (project, location, cluster) of the cluster to set logging. Specified in the format projects/*/locations/*/clusters/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Operation instance.

Raises
set_maintenance_policy(project_id, zone, cluster_id, maintenance_policy, name=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Sets the maintenance policy for a cluster.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> # TODO: Initialize `project_id`:
>>> project_id = ''
>>>
>>> # TODO: Initialize `zone`:
>>> zone = ''
>>>
>>> # TODO: Initialize `cluster_id`:
>>> cluster_id = ''
>>>
>>> # TODO: Initialize `maintenance_policy`:
>>> maintenance_policy = {}
>>>
>>> response = client.set_maintenance_policy(project_id, zone, cluster_id, maintenance_policy)
Parameters
  • project_id (str) – Required. The Google Developers Console project ID or project number.

  • zone (str) – Required. The name of the Google Compute Engine zone in which the cluster resides.

  • cluster_id (str) – Required. The name of the cluster to update.

  • maintenance_policy (Union[dict, MaintenancePolicy]) –

    Required. The maintenance policy to be set for the cluster. An empty field clears the existing maintenance policy.

    If a dict is provided, it must be of the same form as the protobuf message MaintenancePolicy

  • name (str) – The name (project, location, cluster id) of the cluster to set maintenance policy. Specified in the format projects/*/locations/*/clusters/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Operation instance.

Raises
set_master_auth(action, update, project_id=None, zone=None, cluster_id=None, name=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Sets master auth materials. Currently supports changing the admin password or a specific cluster, either via password generation or explicitly setting the password.

Example

>>> from google.cloud import container_v1
>>> from google.cloud.container_v1 import enums
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> # TODO: Initialize `action`:
>>> action = enums.SetMasterAuthRequest.Action.UNKNOWN
>>>
>>> # TODO: Initialize `update`:
>>> update = {}
>>>
>>> response = client.set_master_auth(action, update)
Parameters
  • action (Action) – Required. The exact form of action to be taken on the master auth.

  • update (Union[dict, MasterAuth]) –

    Required. A description of the update.

    If a dict is provided, it must be of the same form as the protobuf message MasterAuth

  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

  • cluster_id (str) – Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.

  • name (str) – The name (project, location, cluster) of the cluster to set auth. Specified in the format projects/*/locations/*/clusters/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Operation instance.

Raises
set_monitoring_service(monitoring_service, project_id=None, zone=None, cluster_id=None, name=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Sets the monitoring service for a specific cluster.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> # TODO: Initialize `monitoring_service`:
>>> monitoring_service = ''
>>>
>>> response = client.set_monitoring_service(monitoring_service)
Parameters
  • monitoring_service (str) –

    Required. The monitoring service the cluster should use to write metrics. Currently available options:

    • ”monitoring.googleapis.com/kubernetes” - the Google Cloud Monitoring service with Kubernetes-native resource model

    • ”monitoring.googleapis.com” - the Google Cloud Monitoring service

    • ”none” - no metrics will be exported from the cluster

  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

  • cluster_id (str) – Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.

  • name (str) – The name (project, location, cluster) of the cluster to set monitoring. Specified in the format projects/*/locations/*/clusters/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Operation instance.

Raises
set_network_policy(network_policy, project_id=None, zone=None, cluster_id=None, name=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Enables or disables Network Policy for a cluster.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> # TODO: Initialize `network_policy`:
>>> network_policy = {}
>>>
>>> response = client.set_network_policy(network_policy)
Parameters
  • network_policy (Union[dict, NetworkPolicy]) –

    Required. Configuration options for the NetworkPolicy feature.

    If a dict is provided, it must be of the same form as the protobuf message NetworkPolicy

  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

  • cluster_id (str) – Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.

  • name (str) – The name (project, location, cluster id) of the cluster to set networking policy. Specified in the format projects/*/locations/*/clusters/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Operation instance.

Raises
set_node_pool_autoscaling(autoscaling, project_id=None, zone=None, cluster_id=None, node_pool_id=None, name=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Sets the autoscaling settings for the specified node pool.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> # TODO: Initialize `autoscaling`:
>>> autoscaling = {}
>>>
>>> response = client.set_node_pool_autoscaling(autoscaling)
Parameters
  • autoscaling (Union[dict, NodePoolAutoscaling]) –

    Required. Autoscaling configuration for the node pool.

    If a dict is provided, it must be of the same form as the protobuf message NodePoolAutoscaling

  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

  • cluster_id (str) – Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.

  • node_pool_id (str) – Deprecated. The name of the node pool to upgrade. This field has been deprecated and replaced by the name field.

  • name (str) – The name (project, location, cluster, node pool) of the node pool to set autoscaler settings. Specified in the format projects/*/locations/*/clusters/*/nodePools/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Operation instance.

Raises
set_node_pool_management(management, project_id=None, zone=None, cluster_id=None, node_pool_id=None, name=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Sets the NodeManagement options for a node pool.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> # TODO: Initialize `management`:
>>> management = {}
>>>
>>> response = client.set_node_pool_management(management)
Parameters
  • management (Union[dict, NodeManagement]) –

    Required. NodeManagement configuration for the node pool.

    If a dict is provided, it must be of the same form as the protobuf message NodeManagement

  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

  • cluster_id (str) – Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.

  • node_pool_id (str) – Deprecated. The name of the node pool to update. This field has been deprecated and replaced by the name field.

  • name (str) – The name (project, location, cluster, node pool id) of the node pool to set management properties. Specified in the format projects/*/locations/*/clusters/*/nodePools/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Operation instance.

Raises
set_node_pool_size(node_count, project_id=None, zone=None, cluster_id=None, node_pool_id=None, name=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Sets the size for a specific node pool.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> # TODO: Initialize `node_count`:
>>> node_count = 0
>>>
>>> response = client.set_node_pool_size(node_count)
Parameters
  • node_count (int) – Required. The desired node count for the pool.

  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

  • cluster_id (str) – Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.

  • node_pool_id (str) – Deprecated. The name of the node pool to update. This field has been deprecated and replaced by the name field.

  • name (str) – The name (project, location, cluster, node pool id) of the node pool to set size. Specified in the format projects/*/locations/*/clusters/*/nodePools/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Operation instance.

Raises
start_i_p_rotation(project_id=None, zone=None, cluster_id=None, name=None, rotate_credentials=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Starts master IP rotation.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> response = client.start_i_p_rotation()
Parameters
  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

  • cluster_id (str) – Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.

  • name (str) – The name (project, location, cluster id) of the cluster to start IP rotation. Specified in the format projects/*/locations/*/clusters/*.

  • rotate_credentials (bool) – Whether to rotate credentials during IP rotation.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Operation instance.

Raises
update_cluster(update, project_id=None, zone=None, cluster_id=None, name=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Updates the settings of a specific cluster.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> # TODO: Initialize `update`:
>>> update = {}
>>>
>>> response = client.update_cluster(update)
Parameters
  • update (Union[dict, ClusterUpdate]) –

    Required. A description of the update.

    If a dict is provided, it must be of the same form as the protobuf message ClusterUpdate

  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

  • cluster_id (str) – Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.

  • name (str) – The name (project, location, cluster) of the cluster to update. Specified in the format projects/*/locations/*/clusters/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Operation instance.

Raises
update_master(master_version, project_id=None, zone=None, cluster_id=None, name=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Updates the master for a specific cluster.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> # TODO: Initialize `master_version`:
>>> master_version = ''
>>>
>>> response = client.update_master(master_version)
Parameters
  • master_version (str) –

    Required. The Kubernetes version to change the master to.

    Users may specify either explicit versions offered by Kubernetes Engine or version aliases, which have the following behavior:

    • ”latest”: picks the highest valid Kubernetes version

    • ”1.X”: picks the highest valid patch+gke.N patch in the 1.X version

    • ”1.X.Y”: picks the highest valid gke.N patch in the 1.X.Y version

    • ”1.X.Y-gke.N”: picks an explicit Kubernetes version

    • ”-“: picks the default Kubernetes version

  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

  • cluster_id (str) – Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.

  • name (str) – The name (project, location, cluster) of the cluster to update. Specified in the format projects/*/locations/*/clusters/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Operation instance.

Raises
update_node_pool(node_version, image_type, project_id=None, zone=None, cluster_id=None, node_pool_id=None, name=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Updates the version and/or image type for the specified node pool.

Example

>>> from google.cloud import container_v1
>>>
>>> client = container_v1.ClusterManagerClient()
>>>
>>> # TODO: Initialize `node_version`:
>>> node_version = ''
>>>
>>> # TODO: Initialize `image_type`:
>>> image_type = ''
>>>
>>> response = client.update_node_pool(node_version, image_type)
Parameters
  • node_version (str) –

    Required. The Kubernetes version to change the nodes to (typically an upgrade).

    Users may specify either explicit versions offered by Kubernetes Engine or version aliases, which have the following behavior:

    • ”latest”: picks the highest valid Kubernetes version

    • ”1.X”: picks the highest valid patch+gke.N patch in the 1.X version

    • ”1.X.Y”: picks the highest valid gke.N patch in the 1.X.Y version

    • ”1.X.Y-gke.N”: picks an explicit Kubernetes version

    • ”-“: picks the Kubernetes master version

  • image_type (str) – Required. The desired image type for the node pool.

  • project_id (str) – Deprecated. The Google Developers Console project ID or project number. This field has been deprecated and replaced by the name field.

  • zone (str) – Deprecated. The name of the Google Compute Engine zone in which the cluster resides. This field has been deprecated and replaced by the name field.

  • cluster_id (str) – Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.

  • node_pool_id (str) – Deprecated. The name of the node pool to upgrade. This field has been deprecated and replaced by the name field.

  • name (str) – The name (project, location, cluster, node pool) of the node pool to update. Specified in the format projects/*/locations/*/clusters/*/nodePools/*.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Operation instance.

Raises