# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import warnings
import pulumi
import pulumi.runtime
from typing import Any, Dict, List, Mapping, Optional, Tuple, Union
from .. import _utilities, _tables
from . import outputs
from ._inputs import *

__all__ = ['Function']


class Function(pulumi.CustomResource):
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 ca_port: Optional[pulumi.Input[float]] = None,
                 code_checksum: Optional[pulumi.Input[str]] = None,
                 custom_container_config: Optional[pulumi.Input[pulumi.InputType['FunctionCustomContainerConfigArgs']]] = None,
                 description: Optional[pulumi.Input[str]] = None,
                 environment_variables: Optional[pulumi.Input[Mapping[str, Any]]] = None,
                 filename: Optional[pulumi.Input[str]] = None,
                 handler: Optional[pulumi.Input[str]] = None,
                 initialization_timeout: Optional[pulumi.Input[float]] = None,
                 initializer: Optional[pulumi.Input[str]] = None,
                 instance_concurrency: Optional[pulumi.Input[float]] = None,
                 instance_type: Optional[pulumi.Input[str]] = None,
                 memory_size: Optional[pulumi.Input[float]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 name_prefix: Optional[pulumi.Input[str]] = None,
                 oss_bucket: Optional[pulumi.Input[str]] = None,
                 oss_key: Optional[pulumi.Input[str]] = None,
                 runtime: Optional[pulumi.Input[str]] = None,
                 service: Optional[pulumi.Input[str]] = None,
                 timeout: Optional[pulumi.Input[float]] = None,
                 __props__=None,
                 __name__=None,
                 __opts__=None):
        """
        Create a Function resource with the given unique name, props, and options.
        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[float] ca_port: The port that the function listen to, only valid for [custom runtime](https://www.alibabacloud.com/help/doc-detail/132044.htm) and [custom container runtime](https://www.alibabacloud.com/help/doc-detail/179368.htm).
        :param pulumi.Input[str] code_checksum: The checksum (crc64) of the function code.
        :param pulumi.Input[pulumi.InputType['FunctionCustomContainerConfigArgs']] custom_container_config: The configuration for custom container runtime.
        :param pulumi.Input[str] description: The Function Compute function description.
        :param pulumi.Input[Mapping[str, Any]] environment_variables: A map that defines environment variables for the function.
        :param pulumi.Input[str] filename: The path to the function's deployment package within the local filesystem. It is conflict with the `oss_`-prefixed options.
        :param pulumi.Input[str] handler: The function [entry point](https://www.alibabacloud.com/help/doc-detail/157704.htm) in your code.
        :param pulumi.Input[float] initialization_timeout: The maximum length of time, in seconds, that the function's initialization should be run for.
        :param pulumi.Input[str] initializer: The entry point of the function's [initialization](https://www.alibabacloud.com/help/doc-detail/157704.htm).
        :param pulumi.Input[float] instance_concurrency: The maximum number of requests can be executed concurrently within the single function instance.
        :param pulumi.Input[str] instance_type: The instance type of the function.
        :param pulumi.Input[float] memory_size: Amount of memory in MB your function can use at runtime. Defaults to `128`. Limits to [128, 3072].
        :param pulumi.Input[str] name: The Function Compute function name. It is the only in one service and is conflict with "name_prefix".
        :param pulumi.Input[str] name_prefix: Setting a prefix to get a only function name. It is conflict with "name".
        :param pulumi.Input[str] oss_bucket: The OSS bucket location containing the function's deployment package. Conflicts with `filename`. This bucket must reside in the same Alibaba Cloud region where you are creating the function.
        :param pulumi.Input[str] oss_key: The OSS key of an object containing the function's deployment package. Conflicts with `filename`.
        :param pulumi.Input[str] runtime: See [Runtimes][https://www.alibabacloud.com/help/doc-detail/52077.htm] for valid values.
        :param pulumi.Input[str] service: The Function Compute service name.
        :param pulumi.Input[float] timeout: The amount of time your function has to run in seconds.
        """
        if __name__ is not None:
            warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
            resource_name = __name__
        if __opts__ is not None:
            warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
            opts = __opts__
        if opts is None:
            opts = pulumi.ResourceOptions()
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        if opts.version is None:
            opts.version = _utilities.get_version()
        if opts.id is None:
            if __props__ is not None:
                raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
            __props__ = dict()

            __props__['ca_port'] = ca_port
            __props__['code_checksum'] = code_checksum
            __props__['custom_container_config'] = custom_container_config
            __props__['description'] = description
            __props__['environment_variables'] = environment_variables
            __props__['filename'] = filename
            if handler is None:
                raise TypeError("Missing required property 'handler'")
            __props__['handler'] = handler
            __props__['initialization_timeout'] = initialization_timeout
            __props__['initializer'] = initializer
            __props__['instance_concurrency'] = instance_concurrency
            __props__['instance_type'] = instance_type
            __props__['memory_size'] = memory_size
            __props__['name'] = name
            __props__['name_prefix'] = name_prefix
            __props__['oss_bucket'] = oss_bucket
            __props__['oss_key'] = oss_key
            if runtime is None:
                raise TypeError("Missing required property 'runtime'")
            __props__['runtime'] = runtime
            if service is None:
                raise TypeError("Missing required property 'service'")
            __props__['service'] = service
            __props__['timeout'] = timeout
            __props__['function_id'] = None
            __props__['last_modified'] = None
        super(Function, __self__).__init__(
            'alicloud:fc/function:Function',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            ca_port: Optional[pulumi.Input[float]] = None,
            code_checksum: Optional[pulumi.Input[str]] = None,
            custom_container_config: Optional[pulumi.Input[pulumi.InputType['FunctionCustomContainerConfigArgs']]] = None,
            description: Optional[pulumi.Input[str]] = None,
            environment_variables: Optional[pulumi.Input[Mapping[str, Any]]] = None,
            filename: Optional[pulumi.Input[str]] = None,
            function_id: Optional[pulumi.Input[str]] = None,
            handler: Optional[pulumi.Input[str]] = None,
            initialization_timeout: Optional[pulumi.Input[float]] = None,
            initializer: Optional[pulumi.Input[str]] = None,
            instance_concurrency: Optional[pulumi.Input[float]] = None,
            instance_type: Optional[pulumi.Input[str]] = None,
            last_modified: Optional[pulumi.Input[str]] = None,
            memory_size: Optional[pulumi.Input[float]] = None,
            name: Optional[pulumi.Input[str]] = None,
            name_prefix: Optional[pulumi.Input[str]] = None,
            oss_bucket: Optional[pulumi.Input[str]] = None,
            oss_key: Optional[pulumi.Input[str]] = None,
            runtime: Optional[pulumi.Input[str]] = None,
            service: Optional[pulumi.Input[str]] = None,
            timeout: Optional[pulumi.Input[float]] = None) -> 'Function':
        """
        Get an existing Function resource's state with the given name, id, and optional extra
        properties used to qualify the lookup.

        :param str resource_name: The unique name of the resulting resource.
        :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[float] ca_port: The port that the function listen to, only valid for [custom runtime](https://www.alibabacloud.com/help/doc-detail/132044.htm) and [custom container runtime](https://www.alibabacloud.com/help/doc-detail/179368.htm).
        :param pulumi.Input[str] code_checksum: The checksum (crc64) of the function code.
        :param pulumi.Input[pulumi.InputType['FunctionCustomContainerConfigArgs']] custom_container_config: The configuration for custom container runtime.
        :param pulumi.Input[str] description: The Function Compute function description.
        :param pulumi.Input[Mapping[str, Any]] environment_variables: A map that defines environment variables for the function.
        :param pulumi.Input[str] filename: The path to the function's deployment package within the local filesystem. It is conflict with the `oss_`-prefixed options.
        :param pulumi.Input[str] function_id: The Function Compute service ID.
        :param pulumi.Input[str] handler: The function [entry point](https://www.alibabacloud.com/help/doc-detail/157704.htm) in your code.
        :param pulumi.Input[float] initialization_timeout: The maximum length of time, in seconds, that the function's initialization should be run for.
        :param pulumi.Input[str] initializer: The entry point of the function's [initialization](https://www.alibabacloud.com/help/doc-detail/157704.htm).
        :param pulumi.Input[float] instance_concurrency: The maximum number of requests can be executed concurrently within the single function instance.
        :param pulumi.Input[str] instance_type: The instance type of the function.
        :param pulumi.Input[str] last_modified: The date this resource was last modified.
        :param pulumi.Input[float] memory_size: Amount of memory in MB your function can use at runtime. Defaults to `128`. Limits to [128, 3072].
        :param pulumi.Input[str] name: The Function Compute function name. It is the only in one service and is conflict with "name_prefix".
        :param pulumi.Input[str] name_prefix: Setting a prefix to get a only function name. It is conflict with "name".
        :param pulumi.Input[str] oss_bucket: The OSS bucket location containing the function's deployment package. Conflicts with `filename`. This bucket must reside in the same Alibaba Cloud region where you are creating the function.
        :param pulumi.Input[str] oss_key: The OSS key of an object containing the function's deployment package. Conflicts with `filename`.
        :param pulumi.Input[str] runtime: See [Runtimes][https://www.alibabacloud.com/help/doc-detail/52077.htm] for valid values.
        :param pulumi.Input[str] service: The Function Compute service name.
        :param pulumi.Input[float] timeout: The amount of time your function has to run in seconds.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()

        __props__["ca_port"] = ca_port
        __props__["code_checksum"] = code_checksum
        __props__["custom_container_config"] = custom_container_config
        __props__["description"] = description
        __props__["environment_variables"] = environment_variables
        __props__["filename"] = filename
        __props__["function_id"] = function_id
        __props__["handler"] = handler
        __props__["initialization_timeout"] = initialization_timeout
        __props__["initializer"] = initializer
        __props__["instance_concurrency"] = instance_concurrency
        __props__["instance_type"] = instance_type
        __props__["last_modified"] = last_modified
        __props__["memory_size"] = memory_size
        __props__["name"] = name
        __props__["name_prefix"] = name_prefix
        __props__["oss_bucket"] = oss_bucket
        __props__["oss_key"] = oss_key
        __props__["runtime"] = runtime
        __props__["service"] = service
        __props__["timeout"] = timeout
        return Function(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="caPort")
    def ca_port(self) -> pulumi.Output[Optional[float]]:
        """
        The port that the function listen to, only valid for [custom runtime](https://www.alibabacloud.com/help/doc-detail/132044.htm) and [custom container runtime](https://www.alibabacloud.com/help/doc-detail/179368.htm).
        """
        return pulumi.get(self, "ca_port")

    @property
    @pulumi.getter(name="codeChecksum")
    def code_checksum(self) -> pulumi.Output[str]:
        """
        The checksum (crc64) of the function code.
        """
        return pulumi.get(self, "code_checksum")

    @property
    @pulumi.getter(name="customContainerConfig")
    def custom_container_config(self) -> pulumi.Output[Optional['outputs.FunctionCustomContainerConfig']]:
        """
        The configuration for custom container runtime.
        """
        return pulumi.get(self, "custom_container_config")

    @property
    @pulumi.getter
    def description(self) -> pulumi.Output[Optional[str]]:
        """
        The Function Compute function description.
        """
        return pulumi.get(self, "description")

    @property
    @pulumi.getter(name="environmentVariables")
    def environment_variables(self) -> pulumi.Output[Optional[Mapping[str, Any]]]:
        """
        A map that defines environment variables for the function.
        """
        return pulumi.get(self, "environment_variables")

    @property
    @pulumi.getter
    def filename(self) -> pulumi.Output[Optional[str]]:
        """
        The path to the function's deployment package within the local filesystem. It is conflict with the `oss_`-prefixed options.
        """
        return pulumi.get(self, "filename")

    @property
    @pulumi.getter(name="functionId")
    def function_id(self) -> pulumi.Output[str]:
        """
        The Function Compute service ID.
        """
        return pulumi.get(self, "function_id")

    @property
    @pulumi.getter
    def handler(self) -> pulumi.Output[str]:
        """
        The function [entry point](https://www.alibabacloud.com/help/doc-detail/157704.htm) in your code.
        """
        return pulumi.get(self, "handler")

    @property
    @pulumi.getter(name="initializationTimeout")
    def initialization_timeout(self) -> pulumi.Output[Optional[float]]:
        """
        The maximum length of time, in seconds, that the function's initialization should be run for.
        """
        return pulumi.get(self, "initialization_timeout")

    @property
    @pulumi.getter
    def initializer(self) -> pulumi.Output[Optional[str]]:
        """
        The entry point of the function's [initialization](https://www.alibabacloud.com/help/doc-detail/157704.htm).
        """
        return pulumi.get(self, "initializer")

    @property
    @pulumi.getter(name="instanceConcurrency")
    def instance_concurrency(self) -> pulumi.Output[Optional[float]]:
        """
        The maximum number of requests can be executed concurrently within the single function instance.
        """
        return pulumi.get(self, "instance_concurrency")

    @property
    @pulumi.getter(name="instanceType")
    def instance_type(self) -> pulumi.Output[Optional[str]]:
        """
        The instance type of the function.
        """
        return pulumi.get(self, "instance_type")

    @property
    @pulumi.getter(name="lastModified")
    def last_modified(self) -> pulumi.Output[str]:
        """
        The date this resource was last modified.
        """
        return pulumi.get(self, "last_modified")

    @property
    @pulumi.getter(name="memorySize")
    def memory_size(self) -> pulumi.Output[Optional[float]]:
        """
        Amount of memory in MB your function can use at runtime. Defaults to `128`. Limits to [128, 3072].
        """
        return pulumi.get(self, "memory_size")

    @property
    @pulumi.getter
    def name(self) -> pulumi.Output[str]:
        """
        The Function Compute function name. It is the only in one service and is conflict with "name_prefix".
        """
        return pulumi.get(self, "name")

    @property
    @pulumi.getter(name="namePrefix")
    def name_prefix(self) -> pulumi.Output[Optional[str]]:
        """
        Setting a prefix to get a only function name. It is conflict with "name".
        """
        return pulumi.get(self, "name_prefix")

    @property
    @pulumi.getter(name="ossBucket")
    def oss_bucket(self) -> pulumi.Output[Optional[str]]:
        """
        The OSS bucket location containing the function's deployment package. Conflicts with `filename`. This bucket must reside in the same Alibaba Cloud region where you are creating the function.
        """
        return pulumi.get(self, "oss_bucket")

    @property
    @pulumi.getter(name="ossKey")
    def oss_key(self) -> pulumi.Output[Optional[str]]:
        """
        The OSS key of an object containing the function's deployment package. Conflicts with `filename`.
        """
        return pulumi.get(self, "oss_key")

    @property
    @pulumi.getter
    def runtime(self) -> pulumi.Output[str]:
        """
        See [Runtimes][https://www.alibabacloud.com/help/doc-detail/52077.htm] for valid values.
        """
        return pulumi.get(self, "runtime")

    @property
    @pulumi.getter
    def service(self) -> pulumi.Output[str]:
        """
        The Function Compute service name.
        """
        return pulumi.get(self, "service")

    @property
    @pulumi.getter
    def timeout(self) -> pulumi.Output[Optional[float]]:
        """
        The amount of time your function has to run in seconds.
        """
        return pulumi.get(self, "timeout")

    def translate_output_property(self, prop):
        return _tables.CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop

    def translate_input_property(self, prop):
        return _tables.SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop

