// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.aws.cloudtrail;

import com.pulumi.aws.Utilities;
import com.pulumi.aws.cloudtrail.inputs.GetFunctionArgs;
import com.pulumi.aws.cloudtrail.inputs.GetFunctionPlainArgs;
import com.pulumi.aws.cloudtrail.inputs.GetServiceAccountArgs;
import com.pulumi.aws.cloudtrail.inputs.GetServiceAccountPlainArgs;
import com.pulumi.aws.cloudtrail.outputs.GetFunctionResult;
import com.pulumi.aws.cloudtrail.outputs.GetServiceAccountResult;
import com.pulumi.core.Output;
import com.pulumi.core.TypeShape;
import com.pulumi.deployment.Deployment;
import com.pulumi.deployment.InvokeOptions;
import java.util.concurrent.CompletableFuture;

public final class CloudtrailFunctions {
    /**
     * Provides information about a CloudFront Function.
     * 
     * ## Example Usage
     * ```java
     * package generated_program;
     * 
     * import com.pulumi.Context;
     * import com.pulumi.Pulumi;
     * import com.pulumi.core.Output;
     * import com.pulumi.aws.cloudfront.CloudfrontFunctions;
     * import com.pulumi.aws.cloudfront.inputs.GetFunctionArgs;
     * import java.util.List;
     * import java.util.ArrayList;
     * import java.util.Map;
     * import java.io.File;
     * import java.nio.file.Files;
     * import java.nio.file.Paths;
     * 
     * public class App {
     *     public static void main(String[] args) {
     *         Pulumi.run(App::stack);
     *     }
     * 
     *     public static void stack(Context ctx) {
     *         final var config = ctx.config();
     *         final var functionName = config.get(&#34;functionName&#34;);
     *         final var existing = CloudfrontFunctions.getFunction(GetFunctionArgs.builder()
     *             .name(functionName)
     *             .build());
     * 
     *     }
     * }
     * ```
     * 
     * @deprecated
     * aws.cloudtrail.getFunction has been deprecated in favor of aws.cloudfront.getFunction
     * 
     */
    @Deprecated /* aws.cloudtrail.getFunction has been deprecated in favor of aws.cloudfront.getFunction */
    public static Output<GetFunctionResult> getFunction(GetFunctionArgs args) {
        return getFunction(args, InvokeOptions.Empty);
    }
    /**
     * Provides information about a CloudFront Function.
     * 
     * ## Example Usage
     * ```java
     * package generated_program;
     * 
     * import com.pulumi.Context;
     * import com.pulumi.Pulumi;
     * import com.pulumi.core.Output;
     * import com.pulumi.aws.cloudfront.CloudfrontFunctions;
     * import com.pulumi.aws.cloudfront.inputs.GetFunctionArgs;
     * import java.util.List;
     * import java.util.ArrayList;
     * import java.util.Map;
     * import java.io.File;
     * import java.nio.file.Files;
     * import java.nio.file.Paths;
     * 
     * public class App {
     *     public static void main(String[] args) {
     *         Pulumi.run(App::stack);
     *     }
     * 
     *     public static void stack(Context ctx) {
     *         final var config = ctx.config();
     *         final var functionName = config.get(&#34;functionName&#34;);
     *         final var existing = CloudfrontFunctions.getFunction(GetFunctionArgs.builder()
     *             .name(functionName)
     *             .build());
     * 
     *     }
     * }
     * ```
     * 
     * @deprecated
     * aws.cloudtrail.getFunction has been deprecated in favor of aws.cloudfront.getFunction
     * 
     */
    @Deprecated /* aws.cloudtrail.getFunction has been deprecated in favor of aws.cloudfront.getFunction */
    public static CompletableFuture<GetFunctionResult> getFunctionPlain(GetFunctionPlainArgs args) {
        return getFunctionPlain(args, InvokeOptions.Empty);
    }
    /**
     * Provides information about a CloudFront Function.
     * 
     * ## Example Usage
     * ```java
     * package generated_program;
     * 
     * import com.pulumi.Context;
     * import com.pulumi.Pulumi;
     * import com.pulumi.core.Output;
     * import com.pulumi.aws.cloudfront.CloudfrontFunctions;
     * import com.pulumi.aws.cloudfront.inputs.GetFunctionArgs;
     * import java.util.List;
     * import java.util.ArrayList;
     * import java.util.Map;
     * import java.io.File;
     * import java.nio.file.Files;
     * import java.nio.file.Paths;
     * 
     * public class App {
     *     public static void main(String[] args) {
     *         Pulumi.run(App::stack);
     *     }
     * 
     *     public static void stack(Context ctx) {
     *         final var config = ctx.config();
     *         final var functionName = config.get(&#34;functionName&#34;);
     *         final var existing = CloudfrontFunctions.getFunction(GetFunctionArgs.builder()
     *             .name(functionName)
     *             .build());
     * 
     *     }
     * }
     * ```
     * 
     * @deprecated
     * aws.cloudtrail.getFunction has been deprecated in favor of aws.cloudfront.getFunction
     * 
     */
    @Deprecated /* aws.cloudtrail.getFunction has been deprecated in favor of aws.cloudfront.getFunction */
    public static Output<GetFunctionResult> getFunction(GetFunctionArgs args, InvokeOptions options) {
        return Deployment.getInstance().invoke("aws:cloudtrail/getFunction:getFunction", TypeShape.of(GetFunctionResult.class), args, Utilities.withVersion(options));
    }
    /**
     * Provides information about a CloudFront Function.
     * 
     * ## Example Usage
     * ```java
     * package generated_program;
     * 
     * import com.pulumi.Context;
     * import com.pulumi.Pulumi;
     * import com.pulumi.core.Output;
     * import com.pulumi.aws.cloudfront.CloudfrontFunctions;
     * import com.pulumi.aws.cloudfront.inputs.GetFunctionArgs;
     * import java.util.List;
     * import java.util.ArrayList;
     * import java.util.Map;
     * import java.io.File;
     * import java.nio.file.Files;
     * import java.nio.file.Paths;
     * 
     * public class App {
     *     public static void main(String[] args) {
     *         Pulumi.run(App::stack);
     *     }
     * 
     *     public static void stack(Context ctx) {
     *         final var config = ctx.config();
     *         final var functionName = config.get(&#34;functionName&#34;);
     *         final var existing = CloudfrontFunctions.getFunction(GetFunctionArgs.builder()
     *             .name(functionName)
     *             .build());
     * 
     *     }
     * }
     * ```
     * 
     * @deprecated
     * aws.cloudtrail.getFunction has been deprecated in favor of aws.cloudfront.getFunction
     * 
     */
    @Deprecated /* aws.cloudtrail.getFunction has been deprecated in favor of aws.cloudfront.getFunction */
    public static CompletableFuture<GetFunctionResult> getFunctionPlain(GetFunctionPlainArgs args, InvokeOptions options) {
        return Deployment.getInstance().invokeAsync("aws:cloudtrail/getFunction:getFunction", TypeShape.of(GetFunctionResult.class), args, Utilities.withVersion(options));
    }
    /**
     * Use this data source to get the Account ID of the [AWS CloudTrail Service Account](http://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-supported-regions.html)
     * in a given region for the purpose of allowing CloudTrail to store trail data in S3.
     * 
     * ## Example Usage
     * ```java
     * package generated_program;
     * 
     * import com.pulumi.Context;
     * import com.pulumi.Pulumi;
     * import com.pulumi.core.Output;
     * import com.pulumi.aws.cloudtrail.CloudtrailFunctions;
     * import com.pulumi.aws.cloudtrail.inputs.GetServiceAccountArgs;
     * import com.pulumi.aws.s3.BucketV2;
     * import com.pulumi.aws.s3.BucketV2Args;
     * import com.pulumi.aws.iam.IamFunctions;
     * import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
     * import com.pulumi.aws.s3.BucketPolicy;
     * import com.pulumi.aws.s3.BucketPolicyArgs;
     * import java.util.List;
     * import java.util.ArrayList;
     * import java.util.Map;
     * import java.io.File;
     * import java.nio.file.Files;
     * import java.nio.file.Paths;
     * 
     * public class App {
     *     public static void main(String[] args) {
     *         Pulumi.run(App::stack);
     *     }
     * 
     *     public static void stack(Context ctx) {
     *         final var main = CloudtrailFunctions.getServiceAccount();
     * 
     *         var bucket = new BucketV2(&#34;bucket&#34;, BucketV2Args.builder()        
     *             .forceDestroy(true)
     *             .build());
     * 
     *         final var allowCloudtrailLoggingPolicyDocument = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
     *             .statements(            
     *                 GetPolicyDocumentStatementArgs.builder()
     *                     .sid(&#34;Put bucket policy needed for trails&#34;)
     *                     .effect(&#34;Allow&#34;)
     *                     .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
     *                         .type(&#34;AWS&#34;)
     *                         .identifiers(main.applyValue(getServiceAccountResult -&gt; getServiceAccountResult.arn()))
     *                         .build())
     *                     .actions(&#34;s3:PutObject&#34;)
     *                     .resources(bucket.arn().applyValue(arn -&gt; String.format(&#34;%s/*&#34;, arn)))
     *                     .build(),
     *                 GetPolicyDocumentStatementArgs.builder()
     *                     .sid(&#34;Get bucket policy needed for trails&#34;)
     *                     .effect(&#34;Allow&#34;)
     *                     .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
     *                         .type(&#34;AWS&#34;)
     *                         .identifiers(main.applyValue(getServiceAccountResult -&gt; getServiceAccountResult.arn()))
     *                         .build())
     *                     .actions(&#34;s3:GetBucketAcl&#34;)
     *                     .resources(bucket.arn())
     *                     .build())
     *             .build());
     * 
     *         var allowCloudtrailLoggingBucketPolicy = new BucketPolicy(&#34;allowCloudtrailLoggingBucketPolicy&#34;, BucketPolicyArgs.builder()        
     *             .bucket(bucket.id())
     *             .policy(allowCloudtrailLoggingPolicyDocument.applyValue(getPolicyDocumentResult -&gt; getPolicyDocumentResult).applyValue(allowCloudtrailLoggingPolicyDocument -&gt; allowCloudtrailLoggingPolicyDocument.applyValue(getPolicyDocumentResult -&gt; getPolicyDocumentResult.json())))
     *             .build());
     * 
     *     }
     * }
     * ```
     * 
     */
    public static Output<GetServiceAccountResult> getServiceAccount() {
        return getServiceAccount(GetServiceAccountArgs.Empty, InvokeOptions.Empty);
    }
    /**
     * Use this data source to get the Account ID of the [AWS CloudTrail Service Account](http://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-supported-regions.html)
     * in a given region for the purpose of allowing CloudTrail to store trail data in S3.
     * 
     * ## Example Usage
     * ```java
     * package generated_program;
     * 
     * import com.pulumi.Context;
     * import com.pulumi.Pulumi;
     * import com.pulumi.core.Output;
     * import com.pulumi.aws.cloudtrail.CloudtrailFunctions;
     * import com.pulumi.aws.cloudtrail.inputs.GetServiceAccountArgs;
     * import com.pulumi.aws.s3.BucketV2;
     * import com.pulumi.aws.s3.BucketV2Args;
     * import com.pulumi.aws.iam.IamFunctions;
     * import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
     * import com.pulumi.aws.s3.BucketPolicy;
     * import com.pulumi.aws.s3.BucketPolicyArgs;
     * import java.util.List;
     * import java.util.ArrayList;
     * import java.util.Map;
     * import java.io.File;
     * import java.nio.file.Files;
     * import java.nio.file.Paths;
     * 
     * public class App {
     *     public static void main(String[] args) {
     *         Pulumi.run(App::stack);
     *     }
     * 
     *     public static void stack(Context ctx) {
     *         final var main = CloudtrailFunctions.getServiceAccount();
     * 
     *         var bucket = new BucketV2(&#34;bucket&#34;, BucketV2Args.builder()        
     *             .forceDestroy(true)
     *             .build());
     * 
     *         final var allowCloudtrailLoggingPolicyDocument = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
     *             .statements(            
     *                 GetPolicyDocumentStatementArgs.builder()
     *                     .sid(&#34;Put bucket policy needed for trails&#34;)
     *                     .effect(&#34;Allow&#34;)
     *                     .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
     *                         .type(&#34;AWS&#34;)
     *                         .identifiers(main.applyValue(getServiceAccountResult -&gt; getServiceAccountResult.arn()))
     *                         .build())
     *                     .actions(&#34;s3:PutObject&#34;)
     *                     .resources(bucket.arn().applyValue(arn -&gt; String.format(&#34;%s/*&#34;, arn)))
     *                     .build(),
     *                 GetPolicyDocumentStatementArgs.builder()
     *                     .sid(&#34;Get bucket policy needed for trails&#34;)
     *                     .effect(&#34;Allow&#34;)
     *                     .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
     *                         .type(&#34;AWS&#34;)
     *                         .identifiers(main.applyValue(getServiceAccountResult -&gt; getServiceAccountResult.arn()))
     *                         .build())
     *                     .actions(&#34;s3:GetBucketAcl&#34;)
     *                     .resources(bucket.arn())
     *                     .build())
     *             .build());
     * 
     *         var allowCloudtrailLoggingBucketPolicy = new BucketPolicy(&#34;allowCloudtrailLoggingBucketPolicy&#34;, BucketPolicyArgs.builder()        
     *             .bucket(bucket.id())
     *             .policy(allowCloudtrailLoggingPolicyDocument.applyValue(getPolicyDocumentResult -&gt; getPolicyDocumentResult).applyValue(allowCloudtrailLoggingPolicyDocument -&gt; allowCloudtrailLoggingPolicyDocument.applyValue(getPolicyDocumentResult -&gt; getPolicyDocumentResult.json())))
     *             .build());
     * 
     *     }
     * }
     * ```
     * 
     */
    public static CompletableFuture<GetServiceAccountResult> getServiceAccountPlain() {
        return getServiceAccountPlain(GetServiceAccountPlainArgs.Empty, InvokeOptions.Empty);
    }
    /**
     * Use this data source to get the Account ID of the [AWS CloudTrail Service Account](http://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-supported-regions.html)
     * in a given region for the purpose of allowing CloudTrail to store trail data in S3.
     * 
     * ## Example Usage
     * ```java
     * package generated_program;
     * 
     * import com.pulumi.Context;
     * import com.pulumi.Pulumi;
     * import com.pulumi.core.Output;
     * import com.pulumi.aws.cloudtrail.CloudtrailFunctions;
     * import com.pulumi.aws.cloudtrail.inputs.GetServiceAccountArgs;
     * import com.pulumi.aws.s3.BucketV2;
     * import com.pulumi.aws.s3.BucketV2Args;
     * import com.pulumi.aws.iam.IamFunctions;
     * import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
     * import com.pulumi.aws.s3.BucketPolicy;
     * import com.pulumi.aws.s3.BucketPolicyArgs;
     * import java.util.List;
     * import java.util.ArrayList;
     * import java.util.Map;
     * import java.io.File;
     * import java.nio.file.Files;
     * import java.nio.file.Paths;
     * 
     * public class App {
     *     public static void main(String[] args) {
     *         Pulumi.run(App::stack);
     *     }
     * 
     *     public static void stack(Context ctx) {
     *         final var main = CloudtrailFunctions.getServiceAccount();
     * 
     *         var bucket = new BucketV2(&#34;bucket&#34;, BucketV2Args.builder()        
     *             .forceDestroy(true)
     *             .build());
     * 
     *         final var allowCloudtrailLoggingPolicyDocument = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
     *             .statements(            
     *                 GetPolicyDocumentStatementArgs.builder()
     *                     .sid(&#34;Put bucket policy needed for trails&#34;)
     *                     .effect(&#34;Allow&#34;)
     *                     .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
     *                         .type(&#34;AWS&#34;)
     *                         .identifiers(main.applyValue(getServiceAccountResult -&gt; getServiceAccountResult.arn()))
     *                         .build())
     *                     .actions(&#34;s3:PutObject&#34;)
     *                     .resources(bucket.arn().applyValue(arn -&gt; String.format(&#34;%s/*&#34;, arn)))
     *                     .build(),
     *                 GetPolicyDocumentStatementArgs.builder()
     *                     .sid(&#34;Get bucket policy needed for trails&#34;)
     *                     .effect(&#34;Allow&#34;)
     *                     .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
     *                         .type(&#34;AWS&#34;)
     *                         .identifiers(main.applyValue(getServiceAccountResult -&gt; getServiceAccountResult.arn()))
     *                         .build())
     *                     .actions(&#34;s3:GetBucketAcl&#34;)
     *                     .resources(bucket.arn())
     *                     .build())
     *             .build());
     * 
     *         var allowCloudtrailLoggingBucketPolicy = new BucketPolicy(&#34;allowCloudtrailLoggingBucketPolicy&#34;, BucketPolicyArgs.builder()        
     *             .bucket(bucket.id())
     *             .policy(allowCloudtrailLoggingPolicyDocument.applyValue(getPolicyDocumentResult -&gt; getPolicyDocumentResult).applyValue(allowCloudtrailLoggingPolicyDocument -&gt; allowCloudtrailLoggingPolicyDocument.applyValue(getPolicyDocumentResult -&gt; getPolicyDocumentResult.json())))
     *             .build());
     * 
     *     }
     * }
     * ```
     * 
     */
    public static Output<GetServiceAccountResult> getServiceAccount(GetServiceAccountArgs args) {
        return getServiceAccount(args, InvokeOptions.Empty);
    }
    /**
     * Use this data source to get the Account ID of the [AWS CloudTrail Service Account](http://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-supported-regions.html)
     * in a given region for the purpose of allowing CloudTrail to store trail data in S3.
     * 
     * ## Example Usage
     * ```java
     * package generated_program;
     * 
     * import com.pulumi.Context;
     * import com.pulumi.Pulumi;
     * import com.pulumi.core.Output;
     * import com.pulumi.aws.cloudtrail.CloudtrailFunctions;
     * import com.pulumi.aws.cloudtrail.inputs.GetServiceAccountArgs;
     * import com.pulumi.aws.s3.BucketV2;
     * import com.pulumi.aws.s3.BucketV2Args;
     * import com.pulumi.aws.iam.IamFunctions;
     * import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
     * import com.pulumi.aws.s3.BucketPolicy;
     * import com.pulumi.aws.s3.BucketPolicyArgs;
     * import java.util.List;
     * import java.util.ArrayList;
     * import java.util.Map;
     * import java.io.File;
     * import java.nio.file.Files;
     * import java.nio.file.Paths;
     * 
     * public class App {
     *     public static void main(String[] args) {
     *         Pulumi.run(App::stack);
     *     }
     * 
     *     public static void stack(Context ctx) {
     *         final var main = CloudtrailFunctions.getServiceAccount();
     * 
     *         var bucket = new BucketV2(&#34;bucket&#34;, BucketV2Args.builder()        
     *             .forceDestroy(true)
     *             .build());
     * 
     *         final var allowCloudtrailLoggingPolicyDocument = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
     *             .statements(            
     *                 GetPolicyDocumentStatementArgs.builder()
     *                     .sid(&#34;Put bucket policy needed for trails&#34;)
     *                     .effect(&#34;Allow&#34;)
     *                     .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
     *                         .type(&#34;AWS&#34;)
     *                         .identifiers(main.applyValue(getServiceAccountResult -&gt; getServiceAccountResult.arn()))
     *                         .build())
     *                     .actions(&#34;s3:PutObject&#34;)
     *                     .resources(bucket.arn().applyValue(arn -&gt; String.format(&#34;%s/*&#34;, arn)))
     *                     .build(),
     *                 GetPolicyDocumentStatementArgs.builder()
     *                     .sid(&#34;Get bucket policy needed for trails&#34;)
     *                     .effect(&#34;Allow&#34;)
     *                     .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
     *                         .type(&#34;AWS&#34;)
     *                         .identifiers(main.applyValue(getServiceAccountResult -&gt; getServiceAccountResult.arn()))
     *                         .build())
     *                     .actions(&#34;s3:GetBucketAcl&#34;)
     *                     .resources(bucket.arn())
     *                     .build())
     *             .build());
     * 
     *         var allowCloudtrailLoggingBucketPolicy = new BucketPolicy(&#34;allowCloudtrailLoggingBucketPolicy&#34;, BucketPolicyArgs.builder()        
     *             .bucket(bucket.id())
     *             .policy(allowCloudtrailLoggingPolicyDocument.applyValue(getPolicyDocumentResult -&gt; getPolicyDocumentResult).applyValue(allowCloudtrailLoggingPolicyDocument -&gt; allowCloudtrailLoggingPolicyDocument.applyValue(getPolicyDocumentResult -&gt; getPolicyDocumentResult.json())))
     *             .build());
     * 
     *     }
     * }
     * ```
     * 
     */
    public static CompletableFuture<GetServiceAccountResult> getServiceAccountPlain(GetServiceAccountPlainArgs args) {
        return getServiceAccountPlain(args, InvokeOptions.Empty);
    }
    /**
     * Use this data source to get the Account ID of the [AWS CloudTrail Service Account](http://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-supported-regions.html)
     * in a given region for the purpose of allowing CloudTrail to store trail data in S3.
     * 
     * ## Example Usage
     * ```java
     * package generated_program;
     * 
     * import com.pulumi.Context;
     * import com.pulumi.Pulumi;
     * import com.pulumi.core.Output;
     * import com.pulumi.aws.cloudtrail.CloudtrailFunctions;
     * import com.pulumi.aws.cloudtrail.inputs.GetServiceAccountArgs;
     * import com.pulumi.aws.s3.BucketV2;
     * import com.pulumi.aws.s3.BucketV2Args;
     * import com.pulumi.aws.iam.IamFunctions;
     * import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
     * import com.pulumi.aws.s3.BucketPolicy;
     * import com.pulumi.aws.s3.BucketPolicyArgs;
     * import java.util.List;
     * import java.util.ArrayList;
     * import java.util.Map;
     * import java.io.File;
     * import java.nio.file.Files;
     * import java.nio.file.Paths;
     * 
     * public class App {
     *     public static void main(String[] args) {
     *         Pulumi.run(App::stack);
     *     }
     * 
     *     public static void stack(Context ctx) {
     *         final var main = CloudtrailFunctions.getServiceAccount();
     * 
     *         var bucket = new BucketV2(&#34;bucket&#34;, BucketV2Args.builder()        
     *             .forceDestroy(true)
     *             .build());
     * 
     *         final var allowCloudtrailLoggingPolicyDocument = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
     *             .statements(            
     *                 GetPolicyDocumentStatementArgs.builder()
     *                     .sid(&#34;Put bucket policy needed for trails&#34;)
     *                     .effect(&#34;Allow&#34;)
     *                     .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
     *                         .type(&#34;AWS&#34;)
     *                         .identifiers(main.applyValue(getServiceAccountResult -&gt; getServiceAccountResult.arn()))
     *                         .build())
     *                     .actions(&#34;s3:PutObject&#34;)
     *                     .resources(bucket.arn().applyValue(arn -&gt; String.format(&#34;%s/*&#34;, arn)))
     *                     .build(),
     *                 GetPolicyDocumentStatementArgs.builder()
     *                     .sid(&#34;Get bucket policy needed for trails&#34;)
     *                     .effect(&#34;Allow&#34;)
     *                     .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
     *                         .type(&#34;AWS&#34;)
     *                         .identifiers(main.applyValue(getServiceAccountResult -&gt; getServiceAccountResult.arn()))
     *                         .build())
     *                     .actions(&#34;s3:GetBucketAcl&#34;)
     *                     .resources(bucket.arn())
     *                     .build())
     *             .build());
     * 
     *         var allowCloudtrailLoggingBucketPolicy = new BucketPolicy(&#34;allowCloudtrailLoggingBucketPolicy&#34;, BucketPolicyArgs.builder()        
     *             .bucket(bucket.id())
     *             .policy(allowCloudtrailLoggingPolicyDocument.applyValue(getPolicyDocumentResult -&gt; getPolicyDocumentResult).applyValue(allowCloudtrailLoggingPolicyDocument -&gt; allowCloudtrailLoggingPolicyDocument.applyValue(getPolicyDocumentResult -&gt; getPolicyDocumentResult.json())))
     *             .build());
     * 
     *     }
     * }
     * ```
     * 
     */
    public static Output<GetServiceAccountResult> getServiceAccount(GetServiceAccountArgs args, InvokeOptions options) {
        return Deployment.getInstance().invoke("aws:cloudtrail/getServiceAccount:getServiceAccount", TypeShape.of(GetServiceAccountResult.class), args, Utilities.withVersion(options));
    }
    /**
     * Use this data source to get the Account ID of the [AWS CloudTrail Service Account](http://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-supported-regions.html)
     * in a given region for the purpose of allowing CloudTrail to store trail data in S3.
     * 
     * ## Example Usage
     * ```java
     * package generated_program;
     * 
     * import com.pulumi.Context;
     * import com.pulumi.Pulumi;
     * import com.pulumi.core.Output;
     * import com.pulumi.aws.cloudtrail.CloudtrailFunctions;
     * import com.pulumi.aws.cloudtrail.inputs.GetServiceAccountArgs;
     * import com.pulumi.aws.s3.BucketV2;
     * import com.pulumi.aws.s3.BucketV2Args;
     * import com.pulumi.aws.iam.IamFunctions;
     * import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
     * import com.pulumi.aws.s3.BucketPolicy;
     * import com.pulumi.aws.s3.BucketPolicyArgs;
     * import java.util.List;
     * import java.util.ArrayList;
     * import java.util.Map;
     * import java.io.File;
     * import java.nio.file.Files;
     * import java.nio.file.Paths;
     * 
     * public class App {
     *     public static void main(String[] args) {
     *         Pulumi.run(App::stack);
     *     }
     * 
     *     public static void stack(Context ctx) {
     *         final var main = CloudtrailFunctions.getServiceAccount();
     * 
     *         var bucket = new BucketV2(&#34;bucket&#34;, BucketV2Args.builder()        
     *             .forceDestroy(true)
     *             .build());
     * 
     *         final var allowCloudtrailLoggingPolicyDocument = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
     *             .statements(            
     *                 GetPolicyDocumentStatementArgs.builder()
     *                     .sid(&#34;Put bucket policy needed for trails&#34;)
     *                     .effect(&#34;Allow&#34;)
     *                     .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
     *                         .type(&#34;AWS&#34;)
     *                         .identifiers(main.applyValue(getServiceAccountResult -&gt; getServiceAccountResult.arn()))
     *                         .build())
     *                     .actions(&#34;s3:PutObject&#34;)
     *                     .resources(bucket.arn().applyValue(arn -&gt; String.format(&#34;%s/*&#34;, arn)))
     *                     .build(),
     *                 GetPolicyDocumentStatementArgs.builder()
     *                     .sid(&#34;Get bucket policy needed for trails&#34;)
     *                     .effect(&#34;Allow&#34;)
     *                     .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
     *                         .type(&#34;AWS&#34;)
     *                         .identifiers(main.applyValue(getServiceAccountResult -&gt; getServiceAccountResult.arn()))
     *                         .build())
     *                     .actions(&#34;s3:GetBucketAcl&#34;)
     *                     .resources(bucket.arn())
     *                     .build())
     *             .build());
     * 
     *         var allowCloudtrailLoggingBucketPolicy = new BucketPolicy(&#34;allowCloudtrailLoggingBucketPolicy&#34;, BucketPolicyArgs.builder()        
     *             .bucket(bucket.id())
     *             .policy(allowCloudtrailLoggingPolicyDocument.applyValue(getPolicyDocumentResult -&gt; getPolicyDocumentResult).applyValue(allowCloudtrailLoggingPolicyDocument -&gt; allowCloudtrailLoggingPolicyDocument.applyValue(getPolicyDocumentResult -&gt; getPolicyDocumentResult.json())))
     *             .build());
     * 
     *     }
     * }
     * ```
     * 
     */
    public static CompletableFuture<GetServiceAccountResult> getServiceAccountPlain(GetServiceAccountPlainArgs args, InvokeOptions options) {
        return Deployment.getInstance().invokeAsync("aws:cloudtrail/getServiceAccount:getServiceAccount", TypeShape.of(GetServiceAccountResult.class), args, Utilities.withVersion(options));
    }
}
