Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.gcp.storage.kotlin.InsightsReportConfig.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.storage.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.storage.kotlin.outputs.InsightsReportConfigCsvOptions
import com.pulumi.gcp.storage.kotlin.outputs.InsightsReportConfigFrequencyOptions
import com.pulumi.gcp.storage.kotlin.outputs.InsightsReportConfigObjectMetadataReportOptions
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import com.pulumi.gcp.storage.kotlin.outputs.InsightsReportConfigCsvOptions.Companion.toKotlin as insightsReportConfigCsvOptionsToKotlin
import com.pulumi.gcp.storage.kotlin.outputs.InsightsReportConfigFrequencyOptions.Companion.toKotlin as insightsReportConfigFrequencyOptionsToKotlin
import com.pulumi.gcp.storage.kotlin.outputs.InsightsReportConfigObjectMetadataReportOptions.Companion.toKotlin as insightsReportConfigObjectMetadataReportOptionsToKotlin
/**
* Builder for [InsightsReportConfig].
*/
@PulumiTagMarker
public class InsightsReportConfigResourceBuilder internal constructor() {
public var name: String? = null
public var args: InsightsReportConfigArgs = InsightsReportConfigArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend InsightsReportConfigArgsBuilder.() -> Unit) {
val builder = InsightsReportConfigArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): InsightsReportConfig {
val builtJavaResource = com.pulumi.gcp.storage.InsightsReportConfig(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return InsightsReportConfig(builtJavaResource)
}
}
/**
* Represents an inventory report configuration.
* To get more information about ReportConfig, see:
* * [API documentation](https://cloud.google.com/storage/docs/json_api/v1/reportConfig)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/storage/docs/insights/using-storage-insights)
* ## Example Usage
* ### Storage Insights Report Config
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const project = gcp.organizations.getProject({});
* const reportBucket = new gcp.storage.Bucket("report_bucket", {
* name: "my-bucket",
* location: "us-central1",
* forceDestroy: true,
* uniformBucketLevelAccess: true,
* });
* const admin = new gcp.storage.BucketIAMMember("admin", {
* bucket: reportBucket.name,
* role: "roles/storage.admin",
* member: project.then(project => `serviceAccount:service-${project.number}@gcp-sa-storageinsights.iam.gserviceaccount.com`),
* });
* const config = new gcp.storage.InsightsReportConfig("config", {
* displayName: "Test Report Config",
* location: "us-central1",
* frequencyOptions: {
* frequency: "WEEKLY",
* startDate: {
* day: 15,
* month: 3,
* year: 2050,
* },
* endDate: {
* day: 15,
* month: 4,
* year: 2050,
* },
* },
* csvOptions: {
* recordSeparator: "\n",
* delimiter: ",",
* headerRequired: false,
* },
* objectMetadataReportOptions: {
* metadataFields: [
* "bucket",
* "name",
* "project",
* ],
* storageFilters: {
* bucket: reportBucket.name,
* },
* storageDestinationOptions: {
* bucket: reportBucket.name,
* destinationPath: "test-insights-reports",
* },
* },
* }, {
* dependsOn: [admin],
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* project = gcp.organizations.get_project()
* report_bucket = gcp.storage.Bucket("report_bucket",
* name="my-bucket",
* location="us-central1",
* force_destroy=True,
* uniform_bucket_level_access=True)
* admin = gcp.storage.BucketIAMMember("admin",
* bucket=report_bucket.name,
* role="roles/storage.admin",
* member=f"serviceAccount:service-{project.number}@gcp-sa-storageinsights.iam.gserviceaccount.com")
* config = gcp.storage.InsightsReportConfig("config",
* display_name="Test Report Config",
* location="us-central1",
* frequency_options={
* "frequency": "WEEKLY",
* "start_date": {
* "day": 15,
* "month": 3,
* "year": 2050,
* },
* "end_date": {
* "day": 15,
* "month": 4,
* "year": 2050,
* },
* },
* csv_options={
* "record_separator": "\n",
* "delimiter": ",",
* "header_required": False,
* },
* object_metadata_report_options={
* "metadata_fields": [
* "bucket",
* "name",
* "project",
* ],
* "storage_filters": {
* "bucket": report_bucket.name,
* },
* "storage_destination_options": {
* "bucket": report_bucket.name,
* "destination_path": "test-insights-reports",
* },
* },
* opts = pulumi.ResourceOptions(depends_on=[admin]))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var project = Gcp.Organizations.GetProject.Invoke();
* var reportBucket = new Gcp.Storage.Bucket("report_bucket", new()
* {
* Name = "my-bucket",
* Location = "us-central1",
* ForceDestroy = true,
* UniformBucketLevelAccess = true,
* });
* var admin = new Gcp.Storage.BucketIAMMember("admin", new()
* {
* Bucket = reportBucket.Name,
* Role = "roles/storage.admin",
* Member = $"serviceAccount:service-{project.Apply(getProjectResult => getProjectResult.Number)}@gcp-sa-storageinsights.iam.gserviceaccount.com",
* });
* var config = new Gcp.Storage.InsightsReportConfig("config", new()
* {
* DisplayName = "Test Report Config",
* Location = "us-central1",
* FrequencyOptions = new Gcp.Storage.Inputs.InsightsReportConfigFrequencyOptionsArgs
* {
* Frequency = "WEEKLY",
* StartDate = new Gcp.Storage.Inputs.InsightsReportConfigFrequencyOptionsStartDateArgs
* {
* Day = 15,
* Month = 3,
* Year = 2050,
* },
* EndDate = new Gcp.Storage.Inputs.InsightsReportConfigFrequencyOptionsEndDateArgs
* {
* Day = 15,
* Month = 4,
* Year = 2050,
* },
* },
* CsvOptions = new Gcp.Storage.Inputs.InsightsReportConfigCsvOptionsArgs
* {
* RecordSeparator = @"
* ",
* Delimiter = ",",
* HeaderRequired = false,
* },
* ObjectMetadataReportOptions = new Gcp.Storage.Inputs.InsightsReportConfigObjectMetadataReportOptionsArgs
* {
* MetadataFields = new[]
* {
* "bucket",
* "name",
* "project",
* },
* StorageFilters = new Gcp.Storage.Inputs.InsightsReportConfigObjectMetadataReportOptionsStorageFiltersArgs
* {
* Bucket = reportBucket.Name,
* },
* StorageDestinationOptions = new Gcp.Storage.Inputs.InsightsReportConfigObjectMetadataReportOptionsStorageDestinationOptionsArgs
* {
* Bucket = reportBucket.Name,
* DestinationPath = "test-insights-reports",
* },
* },
* }, new CustomResourceOptions
* {
* DependsOn =
* {
* admin,
* },
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/storage"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* project, err := organizations.LookupProject(ctx, nil, nil)
* if err != nil {
* return err
* }
* reportBucket, err := storage.NewBucket(ctx, "report_bucket", &storage.BucketArgs{
* Name: pulumi.String("my-bucket"),
* Location: pulumi.String("us-central1"),
* ForceDestroy: pulumi.Bool(true),
* UniformBucketLevelAccess: pulumi.Bool(true),
* })
* if err != nil {
* return err
* }
* admin, err := storage.NewBucketIAMMember(ctx, "admin", &storage.BucketIAMMemberArgs{
* Bucket: reportBucket.Name,
* Role: pulumi.String("roles/storage.admin"),
* Member: pulumi.Sprintf("serviceAccount:service-%[email protected] ", project.Number),
* })
* if err != nil {
* return err
* }
* _, err = storage.NewInsightsReportConfig(ctx, "config", &storage.InsightsReportConfigArgs{
* DisplayName: pulumi.String("Test Report Config"),
* Location: pulumi.String("us-central1"),
* FrequencyOptions: &storage.InsightsReportConfigFrequencyOptionsArgs{
* Frequency: pulumi.String("WEEKLY"),
* StartDate: &storage.InsightsReportConfigFrequencyOptionsStartDateArgs{
* Day: pulumi.Int(15),
* Month: pulumi.Int(3),
* Year: pulumi.Int(2050),
* },
* EndDate: &storage.InsightsReportConfigFrequencyOptionsEndDateArgs{
* Day: pulumi.Int(15),
* Month: pulumi.Int(4),
* Year: pulumi.Int(2050),
* },
* },
* CsvOptions: &storage.InsightsReportConfigCsvOptionsArgs{
* RecordSeparator: pulumi.String("\n"),
* Delimiter: pulumi.String(","),
* HeaderRequired: pulumi.Bool(false),
* },
* ObjectMetadataReportOptions: &storage.InsightsReportConfigObjectMetadataReportOptionsArgs{
* MetadataFields: pulumi.StringArray{
* pulumi.String("bucket"),
* pulumi.String("name"),
* pulumi.String("project"),
* },
* StorageFilters: &storage.InsightsReportConfigObjectMetadataReportOptionsStorageFiltersArgs{
* Bucket: reportBucket.Name,
* },
* StorageDestinationOptions: &storage.InsightsReportConfigObjectMetadataReportOptionsStorageDestinationOptionsArgs{
* Bucket: reportBucket.Name,
* DestinationPath: pulumi.String("test-insights-reports"),
* },
* },
* }, pulumi.DependsOn([]pulumi.Resource{
* admin,
* }))
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.organizations.OrganizationsFunctions;
* import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
* import com.pulumi.gcp.storage.Bucket;
* import com.pulumi.gcp.storage.BucketArgs;
* import com.pulumi.gcp.storage.BucketIAMMember;
* import com.pulumi.gcp.storage.BucketIAMMemberArgs;
* import com.pulumi.gcp.storage.InsightsReportConfig;
* import com.pulumi.gcp.storage.InsightsReportConfigArgs;
* import com.pulumi.gcp.storage.inputs.InsightsReportConfigFrequencyOptionsArgs;
* import com.pulumi.gcp.storage.inputs.InsightsReportConfigFrequencyOptionsStartDateArgs;
* import com.pulumi.gcp.storage.inputs.InsightsReportConfigFrequencyOptionsEndDateArgs;
* import com.pulumi.gcp.storage.inputs.InsightsReportConfigCsvOptionsArgs;
* import com.pulumi.gcp.storage.inputs.InsightsReportConfigObjectMetadataReportOptionsArgs;
* import com.pulumi.gcp.storage.inputs.InsightsReportConfigObjectMetadataReportOptionsStorageFiltersArgs;
* import com.pulumi.gcp.storage.inputs.InsightsReportConfigObjectMetadataReportOptionsStorageDestinationOptionsArgs;
* import com.pulumi.resources.CustomResourceOptions;
* 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 project = OrganizationsFunctions.getProject();
* var reportBucket = new Bucket("reportBucket", BucketArgs.builder()
* .name("my-bucket")
* .location("us-central1")
* .forceDestroy(true)
* .uniformBucketLevelAccess(true)
* .build());
* var admin = new BucketIAMMember("admin", BucketIAMMemberArgs.builder()
* .bucket(reportBucket.name())
* .role("roles/storage.admin")
* .member(String.format("serviceAccount:service-%[email protected] ", project.applyValue(getProjectResult -> getProjectResult.number())))
* .build());
* var config = new InsightsReportConfig("config", InsightsReportConfigArgs.builder()
* .displayName("Test Report Config")
* .location("us-central1")
* .frequencyOptions(InsightsReportConfigFrequencyOptionsArgs.builder()
* .frequency("WEEKLY")
* .startDate(InsightsReportConfigFrequencyOptionsStartDateArgs.builder()
* .day(15)
* .month(3)
* .year(2050)
* .build())
* .endDate(InsightsReportConfigFrequencyOptionsEndDateArgs.builder()
* .day(15)
* .month(4)
* .year(2050)
* .build())
* .build())
* .csvOptions(InsightsReportConfigCsvOptionsArgs.builder()
* .recordSeparator("""
* """)
* .delimiter(",")
* .headerRequired(false)
* .build())
* .objectMetadataReportOptions(InsightsReportConfigObjectMetadataReportOptionsArgs.builder()
* .metadataFields(
* "bucket",
* "name",
* "project")
* .storageFilters(InsightsReportConfigObjectMetadataReportOptionsStorageFiltersArgs.builder()
* .bucket(reportBucket.name())
* .build())
* .storageDestinationOptions(InsightsReportConfigObjectMetadataReportOptionsStorageDestinationOptionsArgs.builder()
* .bucket(reportBucket.name())
* .destinationPath("test-insights-reports")
* .build())
* .build())
* .build(), CustomResourceOptions.builder()
* .dependsOn(admin)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* config:
* type: gcp:storage:InsightsReportConfig
* properties:
* displayName: Test Report Config
* location: us-central1
* frequencyOptions:
* frequency: WEEKLY
* startDate:
* day: 15
* month: 3
* year: 2050
* endDate:
* day: 15
* month: 4
* year: 2050
* csvOptions:
* recordSeparator: |2+
* delimiter: ','
* headerRequired: false
* objectMetadataReportOptions:
* metadataFields:
* - bucket
* - name
* - project
* storageFilters:
* bucket: ${reportBucket.name}
* storageDestinationOptions:
* bucket: ${reportBucket.name}
* destinationPath: test-insights-reports
* options:
* dependson:
* - ${admin}
* reportBucket:
* type: gcp:storage:Bucket
* name: report_bucket
* properties:
* name: my-bucket
* location: us-central1
* forceDestroy: true
* uniformBucketLevelAccess: true
* admin:
* type: gcp:storage:BucketIAMMember
* properties:
* bucket: ${reportBucket.name}
* role: roles/storage.admin
* member: serviceAccount:service-${project.number}@gcp-sa-storageinsights.iam.gserviceaccount.com
* variables:
* project:
* fn::invoke:
* Function: gcp:organizations:getProject
* Arguments: {}
* ```
*
* ## Import
* ReportConfig can be imported using any of these accepted formats:
* * `projects/{{project}}/locations/{{location}}/reportConfigs/{{name}}`
* * `{{project}}/{{location}}/{{name}}`
* * `{{location}}/{{name}}`
* When using the `pulumi import` command, ReportConfig can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:storage/insightsReportConfig:InsightsReportConfig default projects/{{project}}/locations/{{location}}/reportConfigs/{{name}}
* ```
* ```sh
* $ pulumi import gcp:storage/insightsReportConfig:InsightsReportConfig default {{project}}/{{location}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:storage/insightsReportConfig:InsightsReportConfig default {{location}}/{{name}}
* ```
*/
public class InsightsReportConfig internal constructor(
override val javaResource: com.pulumi.gcp.storage.InsightsReportConfig,
) : KotlinCustomResource(javaResource, InsightsReportConfigMapper) {
/**
* Options for configuring the format of the inventory report CSV file.
* Structure is documented below.
*/
public val csvOptions: Output
get() = javaResource.csvOptions().applyValue({ args0 ->
args0.let({ args0 ->
insightsReportConfigCsvOptionsToKotlin(args0)
})
})
/**
* The editable display name of the inventory report configuration. Has a limit of 256 characters. Can be empty.
*/
public val displayName: Output?
get() = javaResource.displayName().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Options for configuring how inventory reports are generated.
*/
public val frequencyOptions: Output?
get() = javaResource.frequencyOptions().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> insightsReportConfigFrequencyOptionsToKotlin(args0) })
}).orElse(null)
})
/**
* The location of the ReportConfig. The source and destination buckets specified in the ReportConfig
* must be in the same location.
*/
public val location: Output
get() = javaResource.location().applyValue({ args0 -> args0 })
/**
* The UUID of the inventory report configuration.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* Options for including metadata in an inventory report.
*/
public val objectMetadataReportOptions: Output?
get() = javaResource.objectMetadataReportOptions().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
insightsReportConfigObjectMetadataReportOptionsToKotlin(args0)
})
}).orElse(null)
})
public val project: Output
get() = javaResource.project().applyValue({ args0 -> args0 })
}
public object InsightsReportConfigMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.storage.InsightsReportConfig::class == javaResource::class
override fun map(javaResource: Resource): InsightsReportConfig = InsightsReportConfig(
javaResource
as com.pulumi.gcp.storage.InsightsReportConfig,
)
}
/**
* @see [InsightsReportConfig].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [InsightsReportConfig].
*/
public suspend fun insightsReportConfig(
name: String,
block: suspend InsightsReportConfigResourceBuilder.() -> Unit,
): InsightsReportConfig {
val builder = InsightsReportConfigResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [InsightsReportConfig].
* @param name The _unique_ name of the resulting resource.
*/
public fun insightsReportConfig(name: String): InsightsReportConfig {
val builder = InsightsReportConfigResourceBuilder()
builder.name(name)
return builder.build()
}