// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***

package onepassword

import (
	"context"
	"reflect"

	"github.com/1Password/pulumi-onepassword/sdk/go/onepassword/internal"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

// Use this data source to get details of an item by its vault uuid and either the title or the uuid of the item.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
//	"github.com/1Password/pulumi-onepassword/sdk/go/onepassword"
//	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
//	func main() {
//		pulumi.Run(func(ctx *pulumi.Context) error {
//			_, err := onepassword.LookupItem(ctx, &onepassword.LookupItemArgs{
//				Title: pulumi.StringRef("your-item-title"),
//				Vault: "your-vault-id",
//			}, nil)
//			if err != nil {
//				return err
//			}
//			return nil
//		})
//	}
//
// ```
func LookupItem(ctx *pulumi.Context, args *LookupItemArgs, opts ...pulumi.InvokeOption) (*LookupItemResult, error) {
	opts = internal.PkgInvokeDefaultOpts(opts)
	var rv LookupItemResult
	err := ctx.Invoke("onepassword:index/getItem:getItem", args, &rv, opts...)
	if err != nil {
		return nil, err
	}
	return &rv, nil
}

// A collection of arguments for invoking getItem.
type LookupItemArgs struct {
	// A list of files attached to the item.
	Files []GetItemFile `pulumi:"files"`
	// Secure Note value.
	NoteValue *string `pulumi:"noteValue"`
	// A list of custom sections in an item
	Sections []GetItemSection `pulumi:"sections"`
	// The title of the item to retrieve. This field will be populated with the title of the item if the item it looked up by its UUID.
	Title *string `pulumi:"title"`
	// The UUID of the item to retrieve. This field will be populated with the UUID of the item if the item it looked up by its title.
	Uuid *string `pulumi:"uuid"`
	// The UUID of the vault the item is in.
	Vault string `pulumi:"vault"`
}

// A collection of values returned by getItem.
type LookupItemResult struct {
	// The category of the item. One of ["login" "password" "database" "secure*note" "document" "ssh*key"]
	Category string `pulumi:"category"`
	// API credential for this item.
	Credential string `pulumi:"credential"`
	// (Only applies to the database category) The name of the database.
	Database string `pulumi:"database"`
	// A list of files attached to the item.
	Files []GetItemFile `pulumi:"files"`
	// (Only applies to the database category) The address where the database can be found
	Hostname string `pulumi:"hostname"`
	Id       string `pulumi:"id"`
	// Secure Note value.
	NoteValue string `pulumi:"noteValue"`
	// Password for this item.
	Password string `pulumi:"password"`
	// (Only applies to the database category) The port the database is listening on.
	Port string `pulumi:"port"`
	// SSH Private Key for this item.
	PrivateKey string `pulumi:"privateKey"`
	// SSH Public Key for this item.
	PublicKey string `pulumi:"publicKey"`
	// A list of custom sections in an item
	Sections []GetItemSection `pulumi:"sections"`
	// An array of strings of the tags assigned to the item.
	Tags []string `pulumi:"tags"`
	// The title of the item to retrieve. This field will be populated with the title of the item if the item it looked up by its UUID.
	Title string `pulumi:"title"`
	// (Only applies to the database category) The type of database. One of ["db2" "filemaker" "msaccess" "mssql" "mysql" "oracle" "postgresql" "sqlite" "other"]
	Type string `pulumi:"type"`
	// The primary URL for the item.
	Url string `pulumi:"url"`
	// Username for this item.
	Username string `pulumi:"username"`
	// The UUID of the item to retrieve. This field will be populated with the UUID of the item if the item it looked up by its title.
	Uuid string `pulumi:"uuid"`
	// The UUID of the vault the item is in.
	Vault string `pulumi:"vault"`
}

func LookupItemOutput(ctx *pulumi.Context, args LookupItemOutputArgs, opts ...pulumi.InvokeOption) LookupItemResultOutput {
	return pulumi.ToOutputWithContext(context.Background(), args).
		ApplyT(func(v interface{}) (LookupItemResult, error) {
			args := v.(LookupItemArgs)
			r, err := LookupItem(ctx, &args, opts...)
			var s LookupItemResult
			if r != nil {
				s = *r
			}
			return s, err
		}).(LookupItemResultOutput)
}

// A collection of arguments for invoking getItem.
type LookupItemOutputArgs struct {
	// A list of files attached to the item.
	Files GetItemFileArrayInput `pulumi:"files"`
	// Secure Note value.
	NoteValue pulumi.StringPtrInput `pulumi:"noteValue"`
	// A list of custom sections in an item
	Sections GetItemSectionArrayInput `pulumi:"sections"`
	// The title of the item to retrieve. This field will be populated with the title of the item if the item it looked up by its UUID.
	Title pulumi.StringPtrInput `pulumi:"title"`
	// The UUID of the item to retrieve. This field will be populated with the UUID of the item if the item it looked up by its title.
	Uuid pulumi.StringPtrInput `pulumi:"uuid"`
	// The UUID of the vault the item is in.
	Vault pulumi.StringInput `pulumi:"vault"`
}

func (LookupItemOutputArgs) ElementType() reflect.Type {
	return reflect.TypeOf((*LookupItemArgs)(nil)).Elem()
}

// A collection of values returned by getItem.
type LookupItemResultOutput struct{ *pulumi.OutputState }

func (LookupItemResultOutput) ElementType() reflect.Type {
	return reflect.TypeOf((*LookupItemResult)(nil)).Elem()
}

func (o LookupItemResultOutput) ToLookupItemResultOutput() LookupItemResultOutput {
	return o
}

func (o LookupItemResultOutput) ToLookupItemResultOutputWithContext(ctx context.Context) LookupItemResultOutput {
	return o
}

// The category of the item. One of ["login" "password" "database" "secure*note" "document" "ssh*key"]
func (o LookupItemResultOutput) Category() pulumi.StringOutput {
	return o.ApplyT(func(v LookupItemResult) string { return v.Category }).(pulumi.StringOutput)
}

// API credential for this item.
func (o LookupItemResultOutput) Credential() pulumi.StringOutput {
	return o.ApplyT(func(v LookupItemResult) string { return v.Credential }).(pulumi.StringOutput)
}

// (Only applies to the database category) The name of the database.
func (o LookupItemResultOutput) Database() pulumi.StringOutput {
	return o.ApplyT(func(v LookupItemResult) string { return v.Database }).(pulumi.StringOutput)
}

// A list of files attached to the item.
func (o LookupItemResultOutput) Files() GetItemFileArrayOutput {
	return o.ApplyT(func(v LookupItemResult) []GetItemFile { return v.Files }).(GetItemFileArrayOutput)
}

// (Only applies to the database category) The address where the database can be found
func (o LookupItemResultOutput) Hostname() pulumi.StringOutput {
	return o.ApplyT(func(v LookupItemResult) string { return v.Hostname }).(pulumi.StringOutput)
}

func (o LookupItemResultOutput) Id() pulumi.StringOutput {
	return o.ApplyT(func(v LookupItemResult) string { return v.Id }).(pulumi.StringOutput)
}

// Secure Note value.
func (o LookupItemResultOutput) NoteValue() pulumi.StringOutput {
	return o.ApplyT(func(v LookupItemResult) string { return v.NoteValue }).(pulumi.StringOutput)
}

// Password for this item.
func (o LookupItemResultOutput) Password() pulumi.StringOutput {
	return o.ApplyT(func(v LookupItemResult) string { return v.Password }).(pulumi.StringOutput)
}

// (Only applies to the database category) The port the database is listening on.
func (o LookupItemResultOutput) Port() pulumi.StringOutput {
	return o.ApplyT(func(v LookupItemResult) string { return v.Port }).(pulumi.StringOutput)
}

// SSH Private Key for this item.
func (o LookupItemResultOutput) PrivateKey() pulumi.StringOutput {
	return o.ApplyT(func(v LookupItemResult) string { return v.PrivateKey }).(pulumi.StringOutput)
}

// SSH Public Key for this item.
func (o LookupItemResultOutput) PublicKey() pulumi.StringOutput {
	return o.ApplyT(func(v LookupItemResult) string { return v.PublicKey }).(pulumi.StringOutput)
}

// A list of custom sections in an item
func (o LookupItemResultOutput) Sections() GetItemSectionArrayOutput {
	return o.ApplyT(func(v LookupItemResult) []GetItemSection { return v.Sections }).(GetItemSectionArrayOutput)
}

// An array of strings of the tags assigned to the item.
func (o LookupItemResultOutput) Tags() pulumi.StringArrayOutput {
	return o.ApplyT(func(v LookupItemResult) []string { return v.Tags }).(pulumi.StringArrayOutput)
}

// The title of the item to retrieve. This field will be populated with the title of the item if the item it looked up by its UUID.
func (o LookupItemResultOutput) Title() pulumi.StringOutput {
	return o.ApplyT(func(v LookupItemResult) string { return v.Title }).(pulumi.StringOutput)
}

// (Only applies to the database category) The type of database. One of ["db2" "filemaker" "msaccess" "mssql" "mysql" "oracle" "postgresql" "sqlite" "other"]
func (o LookupItemResultOutput) Type() pulumi.StringOutput {
	return o.ApplyT(func(v LookupItemResult) string { return v.Type }).(pulumi.StringOutput)
}

// The primary URL for the item.
func (o LookupItemResultOutput) Url() pulumi.StringOutput {
	return o.ApplyT(func(v LookupItemResult) string { return v.Url }).(pulumi.StringOutput)
}

// Username for this item.
func (o LookupItemResultOutput) Username() pulumi.StringOutput {
	return o.ApplyT(func(v LookupItemResult) string { return v.Username }).(pulumi.StringOutput)
}

// The UUID of the item to retrieve. This field will be populated with the UUID of the item if the item it looked up by its title.
func (o LookupItemResultOutput) Uuid() pulumi.StringOutput {
	return o.ApplyT(func(v LookupItemResult) string { return v.Uuid }).(pulumi.StringOutput)
}

// The UUID of the vault the item is in.
func (o LookupItemResultOutput) Vault() pulumi.StringOutput {
	return o.ApplyT(func(v LookupItemResult) string { return v.Vault }).(pulumi.StringOutput)
}

func init() {
	pulumi.RegisterOutputType(LookupItemResultOutput{})
}
