def create(self):
        """Create this cluster.

        .. note::

            Uses the ``project``, ``instance`` and ``cluster_id`` on the
            current :class:`Cluster` in addition to the ``serve_nodes``.
            To change them before creating, reset the values via

            .. code:: python

                cluster.serve_nodes = 8
                cluster.cluster_id = 'i-changed-my-mind'

            before calling :meth:`create`.

        :rtype: :class:`Operation`
        :returns: The long-running operation corresponding to the
                  create operation.
        """
        request_pb = _prepare_create_request(self)
        # We expect a `google.longrunning.operations_pb2.Operation`.
        client = self._instance._client
        operation_pb = client._instance_stub.CreateCluster(request_pb)

        operation = Operation.from_pb(operation_pb, client)
        operation.target = self
        operation.metadata['request_type'] = 'CreateCluster'
        return operation
    def update(self):
        """Update this cluster.

        .. note::

            Updates the ``serve_nodes``. If you'd like to
            change them before updating, reset the values via

            .. code:: python

                cluster.serve_nodes = 8

            before calling :meth:`update`.

        :rtype: :class:`Operation`
        :returns: The long-running operation corresponding to the
                  update operation.
        """
        request_pb = data_v2_pb2.Cluster(
            name=self.name,
            serve_nodes=self.serve_nodes,
        )
        # We expect a `google.longrunning.operations_pb2.Operation`.
        client = self._instance._client
        operation_pb = client._instance_stub.UpdateCluster(request_pb)

        operation = Operation.from_pb(operation_pb, client)
        operation.target = self
        operation.metadata['request_type'] = 'UpdateCluster'
        return operation
    def create(self):
        """Create this instance.

        .. note::

            Uses the ``project`` and ``instance_id`` on the current
            :class:`Instance` in addition to the ``display_name``.
            To change them before creating, reset the values via

            .. code:: python

                instance.display_name = 'New display name'
                instance.instance_id = 'i-changed-my-mind'

            before calling :meth:`create`.

        :rtype: :class:`Operation`
        :returns: The long-running operation corresponding to the
                  create operation.
        """
        request_pb = _prepare_create_request(self)
        # We expect a `google.longrunning.operations_pb2.Operation`.
        operation_pb = self._client._instance_stub.CreateInstance(request_pb)

        operation = Operation.from_pb(operation_pb, self._client)
        operation.target = self
        operation.metadata['request_type'] = 'CreateInstance'
        return operation