All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.aws.s3.outputs.BucketV2CorsRule Maven / Gradle / Ivy

// *** 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.s3.outputs;

import com.pulumi.core.annotations.CustomType;
import com.pulumi.exceptions.MissingRequiredPropertyException;
import java.lang.Integer;
import java.lang.String;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;

@CustomType
public final class BucketV2CorsRule {
    /**
     * @return List of headers allowed.
     * 
     */
    private @Nullable List allowedHeaders;
    /**
     * @return One or more HTTP methods that you allow the origin to execute. Can be `GET`, `PUT`, `POST`, `DELETE` or `HEAD`.
     * 
     */
    private List allowedMethods;
    /**
     * @return One or more origins you want customers to be able to access the bucket from.
     * 
     */
    private List allowedOrigins;
    /**
     * @return One or more headers in the response that you want customers to be able to access from their applications (for example, from a JavaScript `XMLHttpRequest` object).
     * 
     */
    private @Nullable List exposeHeaders;
    /**
     * @return Specifies time in seconds that browser can cache the response for a preflight request.
     * 
     */
    private @Nullable Integer maxAgeSeconds;

    private BucketV2CorsRule() {}
    /**
     * @return List of headers allowed.
     * 
     */
    public List allowedHeaders() {
        return this.allowedHeaders == null ? List.of() : this.allowedHeaders;
    }
    /**
     * @return One or more HTTP methods that you allow the origin to execute. Can be `GET`, `PUT`, `POST`, `DELETE` or `HEAD`.
     * 
     */
    public List allowedMethods() {
        return this.allowedMethods;
    }
    /**
     * @return One or more origins you want customers to be able to access the bucket from.
     * 
     */
    public List allowedOrigins() {
        return this.allowedOrigins;
    }
    /**
     * @return One or more headers in the response that you want customers to be able to access from their applications (for example, from a JavaScript `XMLHttpRequest` object).
     * 
     */
    public List exposeHeaders() {
        return this.exposeHeaders == null ? List.of() : this.exposeHeaders;
    }
    /**
     * @return Specifies time in seconds that browser can cache the response for a preflight request.
     * 
     */
    public Optional maxAgeSeconds() {
        return Optional.ofNullable(this.maxAgeSeconds);
    }

    public static Builder builder() {
        return new Builder();
    }

    public static Builder builder(BucketV2CorsRule defaults) {
        return new Builder(defaults);
    }
    @CustomType.Builder
    public static final class Builder {
        private @Nullable List allowedHeaders;
        private List allowedMethods;
        private List allowedOrigins;
        private @Nullable List exposeHeaders;
        private @Nullable Integer maxAgeSeconds;
        public Builder() {}
        public Builder(BucketV2CorsRule defaults) {
    	      Objects.requireNonNull(defaults);
    	      this.allowedHeaders = defaults.allowedHeaders;
    	      this.allowedMethods = defaults.allowedMethods;
    	      this.allowedOrigins = defaults.allowedOrigins;
    	      this.exposeHeaders = defaults.exposeHeaders;
    	      this.maxAgeSeconds = defaults.maxAgeSeconds;
        }

        @CustomType.Setter
        public Builder allowedHeaders(@Nullable List allowedHeaders) {

            this.allowedHeaders = allowedHeaders;
            return this;
        }
        public Builder allowedHeaders(String... allowedHeaders) {
            return allowedHeaders(List.of(allowedHeaders));
        }
        @CustomType.Setter
        public Builder allowedMethods(List allowedMethods) {
            if (allowedMethods == null) {
              throw new MissingRequiredPropertyException("BucketV2CorsRule", "allowedMethods");
            }
            this.allowedMethods = allowedMethods;
            return this;
        }
        public Builder allowedMethods(String... allowedMethods) {
            return allowedMethods(List.of(allowedMethods));
        }
        @CustomType.Setter
        public Builder allowedOrigins(List allowedOrigins) {
            if (allowedOrigins == null) {
              throw new MissingRequiredPropertyException("BucketV2CorsRule", "allowedOrigins");
            }
            this.allowedOrigins = allowedOrigins;
            return this;
        }
        public Builder allowedOrigins(String... allowedOrigins) {
            return allowedOrigins(List.of(allowedOrigins));
        }
        @CustomType.Setter
        public Builder exposeHeaders(@Nullable List exposeHeaders) {

            this.exposeHeaders = exposeHeaders;
            return this;
        }
        public Builder exposeHeaders(String... exposeHeaders) {
            return exposeHeaders(List.of(exposeHeaders));
        }
        @CustomType.Setter
        public Builder maxAgeSeconds(@Nullable Integer maxAgeSeconds) {

            this.maxAgeSeconds = maxAgeSeconds;
            return this;
        }
        public BucketV2CorsRule build() {
            final var _resultValue = new BucketV2CorsRule();
            _resultValue.allowedHeaders = allowedHeaders;
            _resultValue.allowedMethods = allowedMethods;
            _resultValue.allowedOrigins = allowedOrigins;
            _resultValue.exposeHeaders = exposeHeaders;
            _resultValue.maxAgeSeconds = maxAgeSeconds;
            return _resultValue;
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy