# 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 copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities

__all__ = ['ApiKeyArgs', 'ApiKey']

@pulumi.input_type
class ApiKeyArgs:
    def __init__(__self__, *,
                 acls: pulumi.Input[Sequence[pulumi.Input[str]]],
                 description: pulumi.Input[str],
                 indexes: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 max_hits_per_query: Optional[pulumi.Input[int]] = None,
                 max_queries_per_ip_per_hour: Optional[pulumi.Input[int]] = None,
                 referers: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 validity: Optional[pulumi.Input[int]] = None):
        """
        The set of arguments for constructing a ApiKey resource.
        """
        pulumi.set(__self__, "acls", acls)
        pulumi.set(__self__, "description", description)
        if indexes is not None:
            pulumi.set(__self__, "indexes", indexes)
        if max_hits_per_query is not None:
            pulumi.set(__self__, "max_hits_per_query", max_hits_per_query)
        if max_queries_per_ip_per_hour is not None:
            pulumi.set(__self__, "max_queries_per_ip_per_hour", max_queries_per_ip_per_hour)
        if referers is not None:
            pulumi.set(__self__, "referers", referers)
        if validity is not None:
            pulumi.set(__self__, "validity", validity)

    @property
    @pulumi.getter
    def acls(self) -> pulumi.Input[Sequence[pulumi.Input[str]]]:
        return pulumi.get(self, "acls")

    @acls.setter
    def acls(self, value: pulumi.Input[Sequence[pulumi.Input[str]]]):
        pulumi.set(self, "acls", value)

    @property
    @pulumi.getter
    def description(self) -> pulumi.Input[str]:
        return pulumi.get(self, "description")

    @description.setter
    def description(self, value: pulumi.Input[str]):
        pulumi.set(self, "description", value)

    @property
    @pulumi.getter
    def indexes(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
        return pulumi.get(self, "indexes")

    @indexes.setter
    def indexes(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
        pulumi.set(self, "indexes", value)

    @property
    @pulumi.getter(name="maxHitsPerQuery")
    def max_hits_per_query(self) -> Optional[pulumi.Input[int]]:
        return pulumi.get(self, "max_hits_per_query")

    @max_hits_per_query.setter
    def max_hits_per_query(self, value: Optional[pulumi.Input[int]]):
        pulumi.set(self, "max_hits_per_query", value)

    @property
    @pulumi.getter(name="maxQueriesPerIpPerHour")
    def max_queries_per_ip_per_hour(self) -> Optional[pulumi.Input[int]]:
        return pulumi.get(self, "max_queries_per_ip_per_hour")

    @max_queries_per_ip_per_hour.setter
    def max_queries_per_ip_per_hour(self, value: Optional[pulumi.Input[int]]):
        pulumi.set(self, "max_queries_per_ip_per_hour", value)

    @property
    @pulumi.getter
    def referers(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
        return pulumi.get(self, "referers")

    @referers.setter
    def referers(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
        pulumi.set(self, "referers", value)

    @property
    @pulumi.getter
    def validity(self) -> Optional[pulumi.Input[int]]:
        return pulumi.get(self, "validity")

    @validity.setter
    def validity(self, value: Optional[pulumi.Input[int]]):
        pulumi.set(self, "validity", value)


@pulumi.input_type
class _ApiKeyState:
    def __init__(__self__, *,
                 acls: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 description: Optional[pulumi.Input[str]] = None,
                 indexes: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 key: Optional[pulumi.Input[str]] = None,
                 max_hits_per_query: Optional[pulumi.Input[int]] = None,
                 max_queries_per_ip_per_hour: Optional[pulumi.Input[int]] = None,
                 referers: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 validity: Optional[pulumi.Input[int]] = None):
        """
        Input properties used for looking up and filtering ApiKey resources.
        """
        if acls is not None:
            pulumi.set(__self__, "acls", acls)
        if description is not None:
            pulumi.set(__self__, "description", description)
        if indexes is not None:
            pulumi.set(__self__, "indexes", indexes)
        if key is not None:
            pulumi.set(__self__, "key", key)
        if max_hits_per_query is not None:
            pulumi.set(__self__, "max_hits_per_query", max_hits_per_query)
        if max_queries_per_ip_per_hour is not None:
            pulumi.set(__self__, "max_queries_per_ip_per_hour", max_queries_per_ip_per_hour)
        if referers is not None:
            pulumi.set(__self__, "referers", referers)
        if validity is not None:
            pulumi.set(__self__, "validity", validity)

    @property
    @pulumi.getter
    def acls(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
        return pulumi.get(self, "acls")

    @acls.setter
    def acls(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
        pulumi.set(self, "acls", value)

    @property
    @pulumi.getter
    def description(self) -> Optional[pulumi.Input[str]]:
        return pulumi.get(self, "description")

    @description.setter
    def description(self, value: Optional[pulumi.Input[str]]):
        pulumi.set(self, "description", value)

    @property
    @pulumi.getter
    def indexes(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
        return pulumi.get(self, "indexes")

    @indexes.setter
    def indexes(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
        pulumi.set(self, "indexes", value)

    @property
    @pulumi.getter
    def key(self) -> Optional[pulumi.Input[str]]:
        return pulumi.get(self, "key")

    @key.setter
    def key(self, value: Optional[pulumi.Input[str]]):
        pulumi.set(self, "key", value)

    @property
    @pulumi.getter(name="maxHitsPerQuery")
    def max_hits_per_query(self) -> Optional[pulumi.Input[int]]:
        return pulumi.get(self, "max_hits_per_query")

    @max_hits_per_query.setter
    def max_hits_per_query(self, value: Optional[pulumi.Input[int]]):
        pulumi.set(self, "max_hits_per_query", value)

    @property
    @pulumi.getter(name="maxQueriesPerIpPerHour")
    def max_queries_per_ip_per_hour(self) -> Optional[pulumi.Input[int]]:
        return pulumi.get(self, "max_queries_per_ip_per_hour")

    @max_queries_per_ip_per_hour.setter
    def max_queries_per_ip_per_hour(self, value: Optional[pulumi.Input[int]]):
        pulumi.set(self, "max_queries_per_ip_per_hour", value)

    @property
    @pulumi.getter
    def referers(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
        return pulumi.get(self, "referers")

    @referers.setter
    def referers(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
        pulumi.set(self, "referers", value)

    @property
    @pulumi.getter
    def validity(self) -> Optional[pulumi.Input[int]]:
        return pulumi.get(self, "validity")

    @validity.setter
    def validity(self, value: Optional[pulumi.Input[int]]):
        pulumi.set(self, "validity", value)


class ApiKey(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 acls: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 description: Optional[pulumi.Input[str]] = None,
                 indexes: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 max_hits_per_query: Optional[pulumi.Input[int]] = None,
                 max_queries_per_ip_per_hour: Optional[pulumi.Input[int]] = None,
                 referers: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 validity: Optional[pulumi.Input[int]] = None,
                 __props__=None):
        """
        Create a ApiKey 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.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: ApiKeyArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Create a ApiKey resource with the given unique name, props, and options.
        :param str resource_name: The name of the resource.
        :param ApiKeyArgs args: The arguments to use to populate this resource's properties.
        :param pulumi.ResourceOptions opts: Options for the resource.
        """
        ...
    def __init__(__self__, resource_name: str, *args, **kwargs):
        resource_args, opts = _utilities.get_resource_args_opts(ApiKeyArgs, pulumi.ResourceOptions, *args, **kwargs)
        if resource_args is not None:
            __self__._internal_init(resource_name, opts, **resource_args.__dict__)
        else:
            __self__._internal_init(resource_name, *args, **kwargs)

    def _internal_init(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 acls: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 description: Optional[pulumi.Input[str]] = None,
                 indexes: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 max_hits_per_query: Optional[pulumi.Input[int]] = None,
                 max_queries_per_ip_per_hour: Optional[pulumi.Input[int]] = None,
                 referers: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 validity: Optional[pulumi.Input[int]] = None,
                 __props__=None):
        opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        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__ = ApiKeyArgs.__new__(ApiKeyArgs)

            if acls is None and not opts.urn:
                raise TypeError("Missing required property 'acls'")
            __props__.__dict__["acls"] = acls
            if description is None and not opts.urn:
                raise TypeError("Missing required property 'description'")
            __props__.__dict__["description"] = description
            __props__.__dict__["indexes"] = indexes
            __props__.__dict__["max_hits_per_query"] = max_hits_per_query
            __props__.__dict__["max_queries_per_ip_per_hour"] = max_queries_per_ip_per_hour
            __props__.__dict__["referers"] = referers
            __props__.__dict__["validity"] = validity
            __props__.__dict__["key"] = None
        super(ApiKey, __self__).__init__(
            'algolia:index/apiKey:ApiKey',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            acls: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
            description: Optional[pulumi.Input[str]] = None,
            indexes: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
            key: Optional[pulumi.Input[str]] = None,
            max_hits_per_query: Optional[pulumi.Input[int]] = None,
            max_queries_per_ip_per_hour: Optional[pulumi.Input[int]] = None,
            referers: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
            validity: Optional[pulumi.Input[int]] = None) -> 'ApiKey':
        """
        Get an existing ApiKey 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.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _ApiKeyState.__new__(_ApiKeyState)

        __props__.__dict__["acls"] = acls
        __props__.__dict__["description"] = description
        __props__.__dict__["indexes"] = indexes
        __props__.__dict__["key"] = key
        __props__.__dict__["max_hits_per_query"] = max_hits_per_query
        __props__.__dict__["max_queries_per_ip_per_hour"] = max_queries_per_ip_per_hour
        __props__.__dict__["referers"] = referers
        __props__.__dict__["validity"] = validity
        return ApiKey(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter
    def acls(self) -> pulumi.Output[Sequence[str]]:
        return pulumi.get(self, "acls")

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

    @property
    @pulumi.getter
    def indexes(self) -> pulumi.Output[Sequence[str]]:
        return pulumi.get(self, "indexes")

    @property
    @pulumi.getter
    def key(self) -> pulumi.Output[str]:
        return pulumi.get(self, "key")

    @property
    @pulumi.getter(name="maxHitsPerQuery")
    def max_hits_per_query(self) -> pulumi.Output[Optional[int]]:
        return pulumi.get(self, "max_hits_per_query")

    @property
    @pulumi.getter(name="maxQueriesPerIpPerHour")
    def max_queries_per_ip_per_hour(self) -> pulumi.Output[Optional[int]]:
        return pulumi.get(self, "max_queries_per_ip_per_hour")

    @property
    @pulumi.getter
    def referers(self) -> pulumi.Output[Sequence[str]]:
        return pulumi.get(self, "referers")

    @property
    @pulumi.getter
    def validity(self) -> pulumi.Output[Optional[int]]:
        return pulumi.get(self, "validity")

