github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/polly/getVoices.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package polly
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // Data source for managing an AWS Polly Voices.
    15  //
    16  // ## Example Usage
    17  //
    18  // ### Basic Usage
    19  //
    20  // <!--Start PulumiCodeChooser -->
    21  // ```go
    22  // package main
    23  //
    24  // import (
    25  //
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/polly"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			_, err := polly.GetVoices(ctx, nil, nil)
    34  //			if err != nil {
    35  //				return err
    36  //			}
    37  //			return nil
    38  //		})
    39  //	}
    40  //
    41  // ```
    42  // <!--End PulumiCodeChooser -->
    43  //
    44  // ### With Language Code
    45  //
    46  // <!--Start PulumiCodeChooser -->
    47  // ```go
    48  // package main
    49  //
    50  // import (
    51  //
    52  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/polly"
    53  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    54  //
    55  // )
    56  //
    57  //	func main() {
    58  //		pulumi.Run(func(ctx *pulumi.Context) error {
    59  //			_, err := polly.GetVoices(ctx, &polly.GetVoicesArgs{
    60  //				LanguageCode: pulumi.StringRef("en-GB"),
    61  //			}, nil)
    62  //			if err != nil {
    63  //				return err
    64  //			}
    65  //			return nil
    66  //		})
    67  //	}
    68  //
    69  // ```
    70  // <!--End PulumiCodeChooser -->
    71  func GetVoices(ctx *pulumi.Context, args *GetVoicesArgs, opts ...pulumi.InvokeOption) (*GetVoicesResult, error) {
    72  	opts = internal.PkgInvokeDefaultOpts(opts)
    73  	var rv GetVoicesResult
    74  	err := ctx.Invoke("aws:polly/getVoices:getVoices", args, &rv, opts...)
    75  	if err != nil {
    76  		return nil, err
    77  	}
    78  	return &rv, nil
    79  }
    80  
    81  // A collection of arguments for invoking getVoices.
    82  type GetVoicesArgs struct {
    83  	// Engine used by Amazon Polly when processing input text for speech synthesis. Valid values are `standard`, `neural`, and `long-form`.
    84  	Engine *string `pulumi:"engine"`
    85  	// Whether to return any bilingual voices that use the specified language as an additional language.
    86  	IncludeAdditionalLanguageCodes *bool `pulumi:"includeAdditionalLanguageCodes"`
    87  	// Language identification tag for filtering the list of voices returned. If not specified, all available voices are returned.
    88  	LanguageCode *string `pulumi:"languageCode"`
    89  	// List of voices with their properties. See `voices` Attribute Reference below.
    90  	Voices []GetVoicesVoice `pulumi:"voices"`
    91  }
    92  
    93  // A collection of values returned by getVoices.
    94  type GetVoicesResult struct {
    95  	Engine *string `pulumi:"engine"`
    96  	// Amazon Polly assigned voice ID.
    97  	Id                             string `pulumi:"id"`
    98  	IncludeAdditionalLanguageCodes *bool  `pulumi:"includeAdditionalLanguageCodes"`
    99  	// Language code of the voice.
   100  	LanguageCode *string `pulumi:"languageCode"`
   101  	// List of voices with their properties. See `voices` Attribute Reference below.
   102  	Voices []GetVoicesVoice `pulumi:"voices"`
   103  }
   104  
   105  func GetVoicesOutput(ctx *pulumi.Context, args GetVoicesOutputArgs, opts ...pulumi.InvokeOption) GetVoicesResultOutput {
   106  	return pulumi.ToOutputWithContext(context.Background(), args).
   107  		ApplyT(func(v interface{}) (GetVoicesResult, error) {
   108  			args := v.(GetVoicesArgs)
   109  			r, err := GetVoices(ctx, &args, opts...)
   110  			var s GetVoicesResult
   111  			if r != nil {
   112  				s = *r
   113  			}
   114  			return s, err
   115  		}).(GetVoicesResultOutput)
   116  }
   117  
   118  // A collection of arguments for invoking getVoices.
   119  type GetVoicesOutputArgs struct {
   120  	// Engine used by Amazon Polly when processing input text for speech synthesis. Valid values are `standard`, `neural`, and `long-form`.
   121  	Engine pulumi.StringPtrInput `pulumi:"engine"`
   122  	// Whether to return any bilingual voices that use the specified language as an additional language.
   123  	IncludeAdditionalLanguageCodes pulumi.BoolPtrInput `pulumi:"includeAdditionalLanguageCodes"`
   124  	// Language identification tag for filtering the list of voices returned. If not specified, all available voices are returned.
   125  	LanguageCode pulumi.StringPtrInput `pulumi:"languageCode"`
   126  	// List of voices with their properties. See `voices` Attribute Reference below.
   127  	Voices GetVoicesVoiceArrayInput `pulumi:"voices"`
   128  }
   129  
   130  func (GetVoicesOutputArgs) ElementType() reflect.Type {
   131  	return reflect.TypeOf((*GetVoicesArgs)(nil)).Elem()
   132  }
   133  
   134  // A collection of values returned by getVoices.
   135  type GetVoicesResultOutput struct{ *pulumi.OutputState }
   136  
   137  func (GetVoicesResultOutput) ElementType() reflect.Type {
   138  	return reflect.TypeOf((*GetVoicesResult)(nil)).Elem()
   139  }
   140  
   141  func (o GetVoicesResultOutput) ToGetVoicesResultOutput() GetVoicesResultOutput {
   142  	return o
   143  }
   144  
   145  func (o GetVoicesResultOutput) ToGetVoicesResultOutputWithContext(ctx context.Context) GetVoicesResultOutput {
   146  	return o
   147  }
   148  
   149  func (o GetVoicesResultOutput) Engine() pulumi.StringPtrOutput {
   150  	return o.ApplyT(func(v GetVoicesResult) *string { return v.Engine }).(pulumi.StringPtrOutput)
   151  }
   152  
   153  // Amazon Polly assigned voice ID.
   154  func (o GetVoicesResultOutput) Id() pulumi.StringOutput {
   155  	return o.ApplyT(func(v GetVoicesResult) string { return v.Id }).(pulumi.StringOutput)
   156  }
   157  
   158  func (o GetVoicesResultOutput) IncludeAdditionalLanguageCodes() pulumi.BoolPtrOutput {
   159  	return o.ApplyT(func(v GetVoicesResult) *bool { return v.IncludeAdditionalLanguageCodes }).(pulumi.BoolPtrOutput)
   160  }
   161  
   162  // Language code of the voice.
   163  func (o GetVoicesResultOutput) LanguageCode() pulumi.StringPtrOutput {
   164  	return o.ApplyT(func(v GetVoicesResult) *string { return v.LanguageCode }).(pulumi.StringPtrOutput)
   165  }
   166  
   167  // List of voices with their properties. See `voices` Attribute Reference below.
   168  func (o GetVoicesResultOutput) Voices() GetVoicesVoiceArrayOutput {
   169  	return o.ApplyT(func(v GetVoicesResult) []GetVoicesVoice { return v.Voices }).(GetVoicesVoiceArrayOutput)
   170  }
   171  
   172  func init() {
   173  	pulumi.RegisterOutputType(GetVoicesResultOutput{})
   174  }