Ejemplo n.º 1
0
    def create_application(
            self,
            request: appengine.CreateApplicationRequest = None,
            *,
            retry: retries.Retry = gapic_v1.method.DEFAULT,
            timeout: float = None,
            metadata: Sequence[Tuple[str, str]] = (),
    ) -> gac_operation.Operation:
        r"""Creates an App Engine application for a Google Cloud Platform
        project. Required fields:

        -  ``id`` - The ID of the target Cloud Platform project.
        -  *location* - The
           `region <https://cloud.google.com/appengine/docs/locations>`__
           where you want the App Engine application located.

        For more information about App Engine applications, see
        `Managing Projects, Applications, and
        Billing <https://cloud.google.com/appengine/docs/standard/python/console/>`__.

        Args:
            request (google.cloud.appengine_admin_v1.types.CreateApplicationRequest):
                The request object. Request message for
                `Applications.CreateApplication`.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            google.api_core.operation.Operation:
                An object representing a long-running operation.

                The result type for the operation will be :class:`google.cloud.appengine_admin_v1.types.Application` An Application resource contains the top-level configuration of an App
                   Engine application.

        """
        # Create or coerce a protobuf request object.
        # Minor optimization to avoid making a copy if the user passes
        # in a appengine.CreateApplicationRequest.
        # There's no risk of modifying the input as we've already verified
        # there are no flattened fields.
        if not isinstance(request, appengine.CreateApplicationRequest):
            request = appengine.CreateApplicationRequest(request)

        # Wrap the RPC method; this adds retry and timeout information,
        # and friendly error handling.
        rpc = self._transport._wrapped_methods[
            self._transport.create_application]

        # Send the request.
        response = rpc(
            request,
            retry=retry,
            timeout=timeout,
            metadata=metadata,
        )

        # Wrap the response in an operation future.
        response = gac_operation.from_gapic(
            response,
            self._transport.operations_client,
            application.Application,
            metadata_type=ga_operation.OperationMetadataV1,
        )

        # Done; return the response.
        return response
Ejemplo n.º 2
0
    async def create_application(
        self,
        request: appengine.CreateApplicationRequest = None,
        *,
        retry: retries.Retry = gapic_v1.method.DEFAULT,
        timeout: float = None,
        metadata: Sequence[Tuple[str, str]] = (),
    ) -> operation_async.AsyncOperation:
        r"""Creates an App Engine application for a Google Cloud Platform
        project. Required fields:

        -  ``id`` - The ID of the target Cloud Platform project.
        -  *location* - The
           `region <https://cloud.google.com/appengine/docs/locations>`__
           where you want the App Engine application located.

        For more information about App Engine applications, see
        `Managing Projects, Applications, and
        Billing <https://cloud.google.com/appengine/docs/standard/python/console/>`__.

        Args:
            request (:class:`google.cloud.appengine_admin_v1.types.CreateApplicationRequest`):
                The request object. Request message for
                `Applications.CreateApplication`.

            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            google.api_core.operation_async.AsyncOperation:
                An object representing a long-running operation.

                The result type for the operation will be :class:`google.cloud.appengine_admin_v1.types.Application` An Application resource contains the top-level configuration of an App
                   Engine application.

        """
        # Create or coerce a protobuf request object.

        request = appengine.CreateApplicationRequest(request)

        # Wrap the RPC method; this adds retry and timeout information,
        # and friendly error handling.
        rpc = gapic_v1.method_async.wrap_method(
            self._client._transport.create_application,
            default_timeout=None,
            client_info=DEFAULT_CLIENT_INFO,
        )

        # Send the request.
        response = await rpc(
            request,
            retry=retry,
            timeout=timeout,
            metadata=metadata,
        )

        # Wrap the response in an operation future.
        response = operation_async.from_gapic(
            response,
            self._client._transport.operations_client,
            application.Application,
            metadata_type=ga_operation.OperationMetadataV1,
        )

        # Done; return the response.
        return response