# 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, Mapping, Optional, Sequence, Union, overload
from . import _utilities

__all__ = ['CpCodeArgs', 'CpCode']

@pulumi.input_type
class CpCodeArgs:
    def __init__(__self__, *,
                 contract: Optional[pulumi.Input[str]] = None,
                 contract_id: Optional[pulumi.Input[str]] = None,
                 group: Optional[pulumi.Input[str]] = None,
                 group_id: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 product: Optional[pulumi.Input[str]] = None,
                 product_id: Optional[pulumi.Input[str]] = None):
        """
        The set of arguments for constructing a CpCode resource.
        """
        if contract is not None:
            warnings.warn("""The setting \"contract\" has been deprecated.""", DeprecationWarning)
            pulumi.log.warn("""contract is deprecated: The setting \"contract\" has been deprecated.""")
        if contract is not None:
            pulumi.set(__self__, "contract", contract)
        if contract_id is not None:
            pulumi.set(__self__, "contract_id", contract_id)
        if group is not None:
            warnings.warn("""The setting \"group\" has been deprecated.""", DeprecationWarning)
            pulumi.log.warn("""group is deprecated: The setting \"group\" has been deprecated.""")
        if group is not None:
            pulumi.set(__self__, "group", group)
        if group_id is not None:
            pulumi.set(__self__, "group_id", group_id)
        if name is not None:
            pulumi.set(__self__, "name", name)
        if product is not None:
            warnings.warn("""The setting \"product\" has been deprecated.""", DeprecationWarning)
            pulumi.log.warn("""product is deprecated: The setting \"product\" has been deprecated.""")
        if product is not None:
            pulumi.set(__self__, "product", product)
        if product_id is not None:
            pulumi.set(__self__, "product_id", product_id)

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

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

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

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

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

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

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

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

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

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

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

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

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

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


@pulumi.input_type
class _CpCodeState:
    def __init__(__self__, *,
                 contract: Optional[pulumi.Input[str]] = None,
                 contract_id: Optional[pulumi.Input[str]] = None,
                 group: Optional[pulumi.Input[str]] = None,
                 group_id: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 product: Optional[pulumi.Input[str]] = None,
                 product_id: Optional[pulumi.Input[str]] = None):
        """
        Input properties used for looking up and filtering CpCode resources.
        """
        if contract is not None:
            warnings.warn("""The setting \"contract\" has been deprecated.""", DeprecationWarning)
            pulumi.log.warn("""contract is deprecated: The setting \"contract\" has been deprecated.""")
        if contract is not None:
            pulumi.set(__self__, "contract", contract)
        if contract_id is not None:
            pulumi.set(__self__, "contract_id", contract_id)
        if group is not None:
            warnings.warn("""The setting \"group\" has been deprecated.""", DeprecationWarning)
            pulumi.log.warn("""group is deprecated: The setting \"group\" has been deprecated.""")
        if group is not None:
            pulumi.set(__self__, "group", group)
        if group_id is not None:
            pulumi.set(__self__, "group_id", group_id)
        if name is not None:
            pulumi.set(__self__, "name", name)
        if product is not None:
            warnings.warn("""The setting \"product\" has been deprecated.""", DeprecationWarning)
            pulumi.log.warn("""product is deprecated: The setting \"product\" has been deprecated.""")
        if product is not None:
            pulumi.set(__self__, "product", product)
        if product_id is not None:
            pulumi.set(__self__, "product_id", product_id)

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

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

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

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

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

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

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

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

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

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

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

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

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

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


class CpCode(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 contract: Optional[pulumi.Input[str]] = None,
                 contract_id: Optional[pulumi.Input[str]] = None,
                 group: Optional[pulumi.Input[str]] = None,
                 group_id: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 product: Optional[pulumi.Input[str]] = None,
                 product_id: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        """
        The `CpCode` resource lets you create or reuse content provider (CP) codes.  CP codes track web traffic handled by Akamai servers. Akamai gives you a CP code when you purchase a product. You need this code when you activate associated properties.

        You can create additional CP codes to support more detailed billing and reporting functions.

        By default, the Akamai Provider uses your existing CP code instead of creating a new one.

        ## Example Usage

        Basic usage:

        ```python
        import pulumi
        import pulumi_akamai as akamai

        cp_code = akamai.CpCode("cpCode",
            contract_id=akamai_contract["contract"]["id"],
            group_id=akamai_group["group"]["id"],
            product_id="prd_Object_Delivery")
        ```

        Here's a real-life example that includes other data sources as dependencies:

        ```python
        import pulumi
        import pulumi_akamai as akamai

        group_name = "example group name"
        cpcode_name = "My CP Code"
        example_contract = akamai.get_contract(group_name=group_name)
        example_group = akamai.get_group(name=group_name,
            contract_id=example_contract.id)
        example_cp = akamai.CpCode("exampleCp",
            group_id=example_group.id,
            contract_id=example_contract.id,
            product_id="prd_Object_Delivery")
        ```
        ## Argument reference

        The following arguments are supported:

        <<<<<<< HEAD
        * `name` - (Required) A descriptive label for the CP code. If you're creating a new CP code, the name can’t include commas, underscores, quotes, or any of these special characters: ^ # %.
        * `contract_id` - (Required) A contract's unique ID, including the `ctr_` prefix.
        * `group_id` - (Required) A group's unique ID, including the `grp_` prefix.
        * `product_id` - (Required) A product's unique ID, including the `prd_` prefix.
          =======
        * `name` - (Required) A descriptive label for the CP code. If you're creating a new CP code, the name can’t include commas, underscores, quotes, or any of these special characters: ^ # %.
        * `contract_id` - (Required) A contract's unique ID, including the `ctr_` prefix.
        * `group_id` - (Required) A group's unique ID, including the `grp_` prefix.
        * `product_id` - (Required) A product's unique ID, including the `prd_` prefix.

        ### Deprecated arguments

        > > > > > > > v1.6.1
        * `contract` - (Deprecated) Replaced by `contract_id`. Maintained for legacy purposes.
        * `group` - (Deprecated) Replaced by `group_id`. Maintained for legacy purposes.
        * `product` - (Deprecated) Replaced by `product_id`. Maintained for legacy purposes.

        ## Attributes reference

        * `id` - The ID of the CP code.

        ## Import

        Basic Usagehcl resource "akamai_cp_code" "example" {

        # (resource arguments)

         } You can import your Akamai CP codes using a comma-delimited string of the CP code, contract, and group IDs. You have to enter the IDs in this order`cpcode_id,contract_id,group_id` For example

        ```sh
         $ pulumi import akamai:index/cpCode:CpCode example cpc_123,ctr_1-AB123,grp_123
        ```

        :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: Optional[CpCodeArgs] = None,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        The `CpCode` resource lets you create or reuse content provider (CP) codes.  CP codes track web traffic handled by Akamai servers. Akamai gives you a CP code when you purchase a product. You need this code when you activate associated properties.

        You can create additional CP codes to support more detailed billing and reporting functions.

        By default, the Akamai Provider uses your existing CP code instead of creating a new one.

        ## Example Usage

        Basic usage:

        ```python
        import pulumi
        import pulumi_akamai as akamai

        cp_code = akamai.CpCode("cpCode",
            contract_id=akamai_contract["contract"]["id"],
            group_id=akamai_group["group"]["id"],
            product_id="prd_Object_Delivery")
        ```

        Here's a real-life example that includes other data sources as dependencies:

        ```python
        import pulumi
        import pulumi_akamai as akamai

        group_name = "example group name"
        cpcode_name = "My CP Code"
        example_contract = akamai.get_contract(group_name=group_name)
        example_group = akamai.get_group(name=group_name,
            contract_id=example_contract.id)
        example_cp = akamai.CpCode("exampleCp",
            group_id=example_group.id,
            contract_id=example_contract.id,
            product_id="prd_Object_Delivery")
        ```
        ## Argument reference

        The following arguments are supported:

        <<<<<<< HEAD
        * `name` - (Required) A descriptive label for the CP code. If you're creating a new CP code, the name can’t include commas, underscores, quotes, or any of these special characters: ^ # %.
        * `contract_id` - (Required) A contract's unique ID, including the `ctr_` prefix.
        * `group_id` - (Required) A group's unique ID, including the `grp_` prefix.
        * `product_id` - (Required) A product's unique ID, including the `prd_` prefix.
          =======
        * `name` - (Required) A descriptive label for the CP code. If you're creating a new CP code, the name can’t include commas, underscores, quotes, or any of these special characters: ^ # %.
        * `contract_id` - (Required) A contract's unique ID, including the `ctr_` prefix.
        * `group_id` - (Required) A group's unique ID, including the `grp_` prefix.
        * `product_id` - (Required) A product's unique ID, including the `prd_` prefix.

        ### Deprecated arguments

        > > > > > > > v1.6.1
        * `contract` - (Deprecated) Replaced by `contract_id`. Maintained for legacy purposes.
        * `group` - (Deprecated) Replaced by `group_id`. Maintained for legacy purposes.
        * `product` - (Deprecated) Replaced by `product_id`. Maintained for legacy purposes.

        ## Attributes reference

        * `id` - The ID of the CP code.

        ## Import

        Basic Usagehcl resource "akamai_cp_code" "example" {

        # (resource arguments)

         } You can import your Akamai CP codes using a comma-delimited string of the CP code, contract, and group IDs. You have to enter the IDs in this order`cpcode_id,contract_id,group_id` For example

        ```sh
         $ pulumi import akamai:index/cpCode:CpCode example cpc_123,ctr_1-AB123,grp_123
        ```

        :param str resource_name: The name of the resource.
        :param CpCodeArgs 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(CpCodeArgs, 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,
                 contract: Optional[pulumi.Input[str]] = None,
                 contract_id: Optional[pulumi.Input[str]] = None,
                 group: Optional[pulumi.Input[str]] = None,
                 group_id: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 product: Optional[pulumi.Input[str]] = None,
                 product_id: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        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__ = CpCodeArgs.__new__(CpCodeArgs)

            if contract is not None and not opts.urn:
                warnings.warn("""The setting \"contract\" has been deprecated.""", DeprecationWarning)
                pulumi.log.warn("""contract is deprecated: The setting \"contract\" has been deprecated.""")
            __props__.__dict__["contract"] = contract
            __props__.__dict__["contract_id"] = contract_id
            if group is not None and not opts.urn:
                warnings.warn("""The setting \"group\" has been deprecated.""", DeprecationWarning)
                pulumi.log.warn("""group is deprecated: The setting \"group\" has been deprecated.""")
            __props__.__dict__["group"] = group
            __props__.__dict__["group_id"] = group_id
            __props__.__dict__["name"] = name
            if product is not None and not opts.urn:
                warnings.warn("""The setting \"product\" has been deprecated.""", DeprecationWarning)
                pulumi.log.warn("""product is deprecated: The setting \"product\" has been deprecated.""")
            __props__.__dict__["product"] = product
            __props__.__dict__["product_id"] = product_id
        alias_opts = pulumi.ResourceOptions(aliases=[pulumi.Alias(type_="akamai:properties/cpCode:CpCode")])
        opts = pulumi.ResourceOptions.merge(opts, alias_opts)
        super(CpCode, __self__).__init__(
            'akamai:index/cpCode:CpCode',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            contract: Optional[pulumi.Input[str]] = None,
            contract_id: Optional[pulumi.Input[str]] = None,
            group: Optional[pulumi.Input[str]] = None,
            group_id: Optional[pulumi.Input[str]] = None,
            name: Optional[pulumi.Input[str]] = None,
            product: Optional[pulumi.Input[str]] = None,
            product_id: Optional[pulumi.Input[str]] = None) -> 'CpCode':
        """
        Get an existing CpCode 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__ = _CpCodeState.__new__(_CpCodeState)

        __props__.__dict__["contract"] = contract
        __props__.__dict__["contract_id"] = contract_id
        __props__.__dict__["group"] = group
        __props__.__dict__["group_id"] = group_id
        __props__.__dict__["name"] = name
        __props__.__dict__["product"] = product
        __props__.__dict__["product_id"] = product_id
        return CpCode(resource_name, opts=opts, __props__=__props__)

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

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

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

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

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

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

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

