# 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__ = ['DistributionPublicKeyArgs', 'DistributionPublicKey']

@pulumi.input_type
class DistributionPublicKeyArgs:
    def __init__(__self__, *,
                 alias: pulumi.Input[str],
                 public_key: pulumi.Input[str]):
        """
        The set of arguments for constructing a DistributionPublicKey resource.
        :param pulumi.Input[str] alias: Will be used as an identifier when uploading/retrieving the public key via REST API.
        :param pulumi.Input[str] public_key: The Public key to add as a trusted distribution GPG key.
               
               The following additional attributes are exported:
        """
        pulumi.set(__self__, "alias", alias)
        pulumi.set(__self__, "public_key", public_key)

    @property
    @pulumi.getter
    def alias(self) -> pulumi.Input[str]:
        """
        Will be used as an identifier when uploading/retrieving the public key via REST API.
        """
        return pulumi.get(self, "alias")

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

    @property
    @pulumi.getter(name="publicKey")
    def public_key(self) -> pulumi.Input[str]:
        """
        The Public key to add as a trusted distribution GPG key.

        The following additional attributes are exported:
        """
        return pulumi.get(self, "public_key")

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


@pulumi.input_type
class _DistributionPublicKeyState:
    def __init__(__self__, *,
                 alias: Optional[pulumi.Input[str]] = None,
                 fingerprint: Optional[pulumi.Input[str]] = None,
                 issued_by: Optional[pulumi.Input[str]] = None,
                 issued_on: Optional[pulumi.Input[str]] = None,
                 key_id: Optional[pulumi.Input[str]] = None,
                 public_key: Optional[pulumi.Input[str]] = None,
                 valid_until: Optional[pulumi.Input[str]] = None):
        """
        Input properties used for looking up and filtering DistributionPublicKey resources.
        :param pulumi.Input[str] alias: Will be used as an identifier when uploading/retrieving the public key via REST API.
        :param pulumi.Input[str] fingerprint: Returns the computed key fingerprint
        :param pulumi.Input[str] issued_by: Returns the name and eMail address of issuer
        :param pulumi.Input[str] issued_on: Returns the date/time when this GPG key was created
        :param pulumi.Input[str] key_id: Returns the key id by which this key is referenced in Artifactory
        :param pulumi.Input[str] public_key: The Public key to add as a trusted distribution GPG key.
               
               The following additional attributes are exported:
        :param pulumi.Input[str] valid_until: Returns the date/time when this GPG key expires.
        """
        if alias is not None:
            pulumi.set(__self__, "alias", alias)
        if fingerprint is not None:
            pulumi.set(__self__, "fingerprint", fingerprint)
        if issued_by is not None:
            pulumi.set(__self__, "issued_by", issued_by)
        if issued_on is not None:
            pulumi.set(__self__, "issued_on", issued_on)
        if key_id is not None:
            pulumi.set(__self__, "key_id", key_id)
        if public_key is not None:
            pulumi.set(__self__, "public_key", public_key)
        if valid_until is not None:
            pulumi.set(__self__, "valid_until", valid_until)

    @property
    @pulumi.getter
    def alias(self) -> Optional[pulumi.Input[str]]:
        """
        Will be used as an identifier when uploading/retrieving the public key via REST API.
        """
        return pulumi.get(self, "alias")

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

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

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

    @property
    @pulumi.getter(name="issuedBy")
    def issued_by(self) -> Optional[pulumi.Input[str]]:
        """
        Returns the name and eMail address of issuer
        """
        return pulumi.get(self, "issued_by")

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

    @property
    @pulumi.getter(name="issuedOn")
    def issued_on(self) -> Optional[pulumi.Input[str]]:
        """
        Returns the date/time when this GPG key was created
        """
        return pulumi.get(self, "issued_on")

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

    @property
    @pulumi.getter(name="keyId")
    def key_id(self) -> Optional[pulumi.Input[str]]:
        """
        Returns the key id by which this key is referenced in Artifactory
        """
        return pulumi.get(self, "key_id")

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

    @property
    @pulumi.getter(name="publicKey")
    def public_key(self) -> Optional[pulumi.Input[str]]:
        """
        The Public key to add as a trusted distribution GPG key.

        The following additional attributes are exported:
        """
        return pulumi.get(self, "public_key")

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

    @property
    @pulumi.getter(name="validUntil")
    def valid_until(self) -> Optional[pulumi.Input[str]]:
        """
        Returns the date/time when this GPG key expires.
        """
        return pulumi.get(self, "valid_until")

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


class DistributionPublicKey(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 alias: Optional[pulumi.Input[str]] = None,
                 public_key: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        """
        Provides an Artifactory Distribution Public Key resource. This can be used to create and manage Artifactory Distribution Public Keys.

        See [API description](https://jfrog.com/help/r/jfrog-rest-apis/set-distributionpublic-gpg-key) in the Artifactory documentation for more details. Also the [UI documentation](https://jfrog.com/help/r/jfrog-platform-administration-documentation/managing-webstart-and-jar-signing) has further details on where to find these keys in Artifactory.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_artifactory as artifactory
        import pulumi_std as std

        my_key = artifactory.DistributionPublicKey("my-key",
            alias="my-key",
            public_key=std.file(input="samples/rsa.pub").result)
        ```

        ## Import

        Distribution Public Key can be imported using the key id, e.g.

        ```sh
        $ pulumi import artifactory:index/distributionPublicKey:DistributionPublicKey my-key keyid
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] alias: Will be used as an identifier when uploading/retrieving the public key via REST API.
        :param pulumi.Input[str] public_key: The Public key to add as a trusted distribution GPG key.
               
               The following additional attributes are exported:
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: DistributionPublicKeyArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Provides an Artifactory Distribution Public Key resource. This can be used to create and manage Artifactory Distribution Public Keys.

        See [API description](https://jfrog.com/help/r/jfrog-rest-apis/set-distributionpublic-gpg-key) in the Artifactory documentation for more details. Also the [UI documentation](https://jfrog.com/help/r/jfrog-platform-administration-documentation/managing-webstart-and-jar-signing) has further details on where to find these keys in Artifactory.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_artifactory as artifactory
        import pulumi_std as std

        my_key = artifactory.DistributionPublicKey("my-key",
            alias="my-key",
            public_key=std.file(input="samples/rsa.pub").result)
        ```

        ## Import

        Distribution Public Key can be imported using the key id, e.g.

        ```sh
        $ pulumi import artifactory:index/distributionPublicKey:DistributionPublicKey my-key keyid
        ```

        :param str resource_name: The name of the resource.
        :param DistributionPublicKeyArgs 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(DistributionPublicKeyArgs, 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,
                 alias: Optional[pulumi.Input[str]] = None,
                 public_key: Optional[pulumi.Input[str]] = 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__ = DistributionPublicKeyArgs.__new__(DistributionPublicKeyArgs)

            if alias is None and not opts.urn:
                raise TypeError("Missing required property 'alias'")
            __props__.__dict__["alias"] = alias
            if public_key is None and not opts.urn:
                raise TypeError("Missing required property 'public_key'")
            __props__.__dict__["public_key"] = public_key
            __props__.__dict__["fingerprint"] = None
            __props__.__dict__["issued_by"] = None
            __props__.__dict__["issued_on"] = None
            __props__.__dict__["key_id"] = None
            __props__.__dict__["valid_until"] = None
        super(DistributionPublicKey, __self__).__init__(
            'artifactory:index/distributionPublicKey:DistributionPublicKey',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            alias: Optional[pulumi.Input[str]] = None,
            fingerprint: Optional[pulumi.Input[str]] = None,
            issued_by: Optional[pulumi.Input[str]] = None,
            issued_on: Optional[pulumi.Input[str]] = None,
            key_id: Optional[pulumi.Input[str]] = None,
            public_key: Optional[pulumi.Input[str]] = None,
            valid_until: Optional[pulumi.Input[str]] = None) -> 'DistributionPublicKey':
        """
        Get an existing DistributionPublicKey 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[str] alias: Will be used as an identifier when uploading/retrieving the public key via REST API.
        :param pulumi.Input[str] fingerprint: Returns the computed key fingerprint
        :param pulumi.Input[str] issued_by: Returns the name and eMail address of issuer
        :param pulumi.Input[str] issued_on: Returns the date/time when this GPG key was created
        :param pulumi.Input[str] key_id: Returns the key id by which this key is referenced in Artifactory
        :param pulumi.Input[str] public_key: The Public key to add as a trusted distribution GPG key.
               
               The following additional attributes are exported:
        :param pulumi.Input[str] valid_until: Returns the date/time when this GPG key expires.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _DistributionPublicKeyState.__new__(_DistributionPublicKeyState)

        __props__.__dict__["alias"] = alias
        __props__.__dict__["fingerprint"] = fingerprint
        __props__.__dict__["issued_by"] = issued_by
        __props__.__dict__["issued_on"] = issued_on
        __props__.__dict__["key_id"] = key_id
        __props__.__dict__["public_key"] = public_key
        __props__.__dict__["valid_until"] = valid_until
        return DistributionPublicKey(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter
    def alias(self) -> pulumi.Output[str]:
        """
        Will be used as an identifier when uploading/retrieving the public key via REST API.
        """
        return pulumi.get(self, "alias")

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

    @property
    @pulumi.getter(name="issuedBy")
    def issued_by(self) -> pulumi.Output[str]:
        """
        Returns the name and eMail address of issuer
        """
        return pulumi.get(self, "issued_by")

    @property
    @pulumi.getter(name="issuedOn")
    def issued_on(self) -> pulumi.Output[str]:
        """
        Returns the date/time when this GPG key was created
        """
        return pulumi.get(self, "issued_on")

    @property
    @pulumi.getter(name="keyId")
    def key_id(self) -> pulumi.Output[str]:
        """
        Returns the key id by which this key is referenced in Artifactory
        """
        return pulumi.get(self, "key_id")

    @property
    @pulumi.getter(name="publicKey")
    def public_key(self) -> pulumi.Output[str]:
        """
        The Public key to add as a trusted distribution GPG key.

        The following additional attributes are exported:
        """
        return pulumi.get(self, "public_key")

    @property
    @pulumi.getter(name="validUntil")
    def valid_until(self) -> pulumi.Output[str]:
        """
        Returns the date/time when this GPG key expires.
        """
        return pulumi.get(self, "valid_until")

