<reponame>Regrau/pulumi-yandex<gh_stars>0// *** 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! ***

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;

namespace Pulumi.Yandex
{
    /// <summary>
    /// Allows management of [Yandex.Cloud IAM service account static access keys](https://cloud.yandex.com/docs/iam/operations/sa/create-access-key).
    /// Generated pair of keys is used to access [Yandex Object Storage](https://cloud.yandex.com/docs/storage) on behalf of service account.
    /// 
    /// Before using keys do not forget to [assign a proper role](https://cloud.yandex.com/docs/iam/operations/sa/assign-role-for-sa) to the service account.
    /// 
    /// ## Example Usage
    /// 
    /// This snippet creates a service account static access key.
    /// 
    /// ```csharp
    /// using System.Collections.Generic;
    /// using Pulumi;
    /// using Yandex = Pulumi.Yandex;
    /// 
    /// return await Deployment.RunAsync(() =&gt; 
    /// {
    ///     var sa_static_key = new Yandex.IamServiceAccountStaticAccessKey("sa-static-key", new()
    ///     {
    ///         Description = "static access key for object storage",
    ///         PgpKey = "keybase:keybaseusername",
    ///         ServiceAccountId = "some_sa_id",
    ///     });
    /// 
    /// });
    /// ```
    /// </summary>
    [YandexResourceType("yandex:index/iamServiceAccountStaticAccessKey:IamServiceAccountStaticAccessKey")]
    public partial class IamServiceAccountStaticAccessKey : global::Pulumi.CustomResource
    {
        /// <summary>
        /// ID of the static access key.
        /// </summary>
        [Output("accessKey")]
        public Output<string> AccessKey { get; private set; } = null!;

        /// <summary>
        /// Creation timestamp of the static access key.
        /// </summary>
        [Output("createdAt")]
        public Output<string> CreatedAt { get; private set; } = null!;

        /// <summary>
        /// The description of the service account static key.
        /// </summary>
        [Output("description")]
        public Output<string?> Description { get; private set; } = null!;

        /// <summary>
        /// The encrypted secret, base64 encoded. This is only populated when `pgp_key` is supplied.
        /// </summary>
        [Output("encryptedSecretKey")]
        public Output<string> EncryptedSecretKey { get; private set; } = null!;

        /// <summary>
        /// The fingerprint of the PGP key used to encrypt the secret key. This is only populated when `pgp_key` is supplied.
        /// </summary>
        [Output("keyFingerprint")]
        public Output<string> KeyFingerprint { get; private set; } = null!;

        /// <summary>
        /// An optional PGP key to encrypt the resulting secret key material. May either be a base64-encoded public key or a keybase username in the form `keybase:keybaseusername`.
        /// </summary>
        [Output("pgpKey")]
        public Output<string?> PgpKey { get; private set; } = null!;

        /// <summary>
        /// Private part of generated static access key. This is only populated when no `pgp_key` is provided.
        /// </summary>
        [Output("secretKey")]
        public Output<string> SecretKey { get; private set; } = null!;

        /// <summary>
        /// ID of the service account which is used to get a static key.
        /// </summary>
        [Output("serviceAccountId")]
        public Output<string> ServiceAccountId { get; private set; } = null!;


        /// <summary>
        /// Create a IamServiceAccountStaticAccessKey resource with the given unique name, arguments, and options.
        /// </summary>
        ///
        /// <param name="name">The unique name of the resource</param>
        /// <param name="args">The arguments used to populate this resource's properties</param>
        /// <param name="options">A bag of options that control this resource's behavior</param>
        public IamServiceAccountStaticAccessKey(string name, IamServiceAccountStaticAccessKeyArgs args, CustomResourceOptions? options = null)
            : base("yandex:index/iamServiceAccountStaticAccessKey:IamServiceAccountStaticAccessKey", name, args ?? new IamServiceAccountStaticAccessKeyArgs(), MakeResourceOptions(options, ""))
        {
        }

        private IamServiceAccountStaticAccessKey(string name, Input<string> id, IamServiceAccountStaticAccessKeyState? state = null, CustomResourceOptions? options = null)
            : base("yandex:index/iamServiceAccountStaticAccessKey:IamServiceAccountStaticAccessKey", name, state, MakeResourceOptions(options, id))
        {
        }

        private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
        {
            var defaultOptions = new CustomResourceOptions
            {
                Version = Utilities.Version,
                PluginDownloadURL = "https://github.com/regrau/pulumi-yandex/releases",
                AdditionalSecretOutputs =
                {
                    "secretKey",
                },
            };
            var merged = CustomResourceOptions.Merge(defaultOptions, options);
            // Override the ID if one was specified for consistency with other language SDKs.
            merged.Id = id ?? merged.Id;
            return merged;
        }
        /// <summary>
        /// Get an existing IamServiceAccountStaticAccessKey resource's state with the given name, ID, and optional extra
        /// properties used to qualify the lookup.
        /// </summary>
        ///
        /// <param name="name">The unique name of the resulting resource.</param>
        /// <param name="id">The unique provider ID of the resource to lookup.</param>
        /// <param name="state">Any extra arguments used during the lookup.</param>
        /// <param name="options">A bag of options that control this resource's behavior</param>
        public static IamServiceAccountStaticAccessKey Get(string name, Input<string> id, IamServiceAccountStaticAccessKeyState? state = null, CustomResourceOptions? options = null)
        {
            return new IamServiceAccountStaticAccessKey(name, id, state, options);
        }
    }

    public sealed class IamServiceAccountStaticAccessKeyArgs : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// The description of the service account static key.
        /// </summary>
        [Input("description")]
        public Input<string>? Description { get; set; }

        /// <summary>
        /// An optional PGP key to encrypt the resulting secret key material. May either be a base64-encoded public key or a keybase username in the form `keybase:keybaseusername`.
        /// </summary>
        [Input("pgpKey")]
        public Input<string>? PgpKey { get; set; }

        /// <summary>
        /// ID of the service account which is used to get a static key.
        /// </summary>
        [Input("serviceAccountId", required: true)]
        public Input<string> ServiceAccountId { get; set; } = null!;

        public IamServiceAccountStaticAccessKeyArgs()
        {
        }
        public static new IamServiceAccountStaticAccessKeyArgs Empty => new IamServiceAccountStaticAccessKeyArgs();
    }

    public sealed class IamServiceAccountStaticAccessKeyState : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// ID of the static access key.
        /// </summary>
        [Input("accessKey")]
        public Input<string>? AccessKey { get; set; }

        /// <summary>
        /// Creation timestamp of the static access key.
        /// </summary>
        [Input("createdAt")]
        public Input<string>? CreatedAt { get; set; }

        /// <summary>
        /// The description of the service account static key.
        /// </summary>
        [Input("description")]
        public Input<string>? Description { get; set; }

        /// <summary>
        /// The encrypted secret, base64 encoded. This is only populated when `pgp_key` is supplied.
        /// </summary>
        [Input("encryptedSecretKey")]
        public Input<string>? EncryptedSecretKey { get; set; }

        /// <summary>
        /// The fingerprint of the PGP key used to encrypt the secret key. This is only populated when `pgp_key` is supplied.
        /// </summary>
        [Input("keyFingerprint")]
        public Input<string>? KeyFingerprint { get; set; }

        /// <summary>
        /// An optional PGP key to encrypt the resulting secret key material. May either be a base64-encoded public key or a keybase username in the form `keybase:keybaseusername`.
        /// </summary>
        [Input("pgpKey")]
        public Input<string>? PgpKey { get; set; }

        [Input("secretKey")]
        private Input<string>? _secretKey;

        /// <summary>
        /// Private part of generated static access key. This is only populated when no `pgp_key` is provided.
        /// </summary>
        public Input<string>? SecretKey
        {
            get => _secretKey;
            set
            {
                var emptySecret = Output.CreateSecret(0);
                _secretKey = Output.Tuple<Input<string>?, int>(value, emptySecret).Apply(t => t.Item1);
            }
        }

        /// <summary>
        /// ID of the service account which is used to get a static key.
        /// </summary>
        [Input("serviceAccountId")]
        public Input<string>? ServiceAccountId { get; set; }

        public IamServiceAccountStaticAccessKeyState()
        {
        }
        public static new IamServiceAccountStaticAccessKeyState Empty => new IamServiceAccountStaticAccessKeyState();
    }
}
