Class: Google::Apis::ComputeV1::CorsPolicy

Inherits:
Object
  • Object
show all
Includes:
Google::Apis::Core::Hashable, Google::Apis::Core::JsonObjectSupport
Defined in:
lib/google/apis/compute_v1/classes.rb,
lib/google/apis/compute_v1/representations.rb,
lib/google/apis/compute_v1/representations.rb

Overview

The specification for allowing client-side cross-origin requests. For more information about the W3C recommendation for cross-origin resource sharing ( CORS), see Fetch API Living Standard.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ CorsPolicy

Returns a new instance of CorsPolicy.



6147
6148
6149
# File 'lib/google/apis/compute_v1/classes.rb', line 6147

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#allow_credentialsBoolean Also known as: allow_credentials?

In response to a preflight request, setting this to true indicates that the actual request can include user credentials. This field translates to the Access-Control-Allow-Credentials header. Default is false. Corresponds to the JSON property allowCredentials

Returns:

  • (Boolean)


6100
6101
6102
# File 'lib/google/apis/compute_v1/classes.rb', line 6100

def allow_credentials
  @allow_credentials
end

#allow_headersArray<String>

Specifies the content for the Access-Control-Allow-Headers header. Corresponds to the JSON property allowHeaders

Returns:

  • (Array<String>)


6106
6107
6108
# File 'lib/google/apis/compute_v1/classes.rb', line 6106

def allow_headers
  @allow_headers
end

#allow_methodsArray<String>

Specifies the content for the Access-Control-Allow-Methods header. Corresponds to the JSON property allowMethods

Returns:

  • (Array<String>)


6111
6112
6113
# File 'lib/google/apis/compute_v1/classes.rb', line 6111

def allow_methods
  @allow_methods
end

#allow_origin_regexesArray<String>

Specifies a regular expression that matches allowed origins. For more information, see regular expression syntax . An origin is allowed if it matches either an item in allowOrigins or an item in allowOriginRegexes. Regular expressions can only be used when the loadBalancingScheme is set to INTERNAL_SELF_MANAGED. Corresponds to the JSON property allowOriginRegexes

Returns:

  • (Array<String>)


6120
6121
6122
# File 'lib/google/apis/compute_v1/classes.rb', line 6120

def allow_origin_regexes
  @allow_origin_regexes
end

#allow_originsArray<String>

Specifies the list of origins that is allowed to do CORS requests. An origin is allowed if it matches either an item in allowOrigins or an item in allowOriginRegexes. Corresponds to the JSON property allowOrigins

Returns:

  • (Array<String>)


6127
6128
6129
# File 'lib/google/apis/compute_v1/classes.rb', line 6127

def allow_origins
  @allow_origins
end

#disabledBoolean Also known as: disabled?

If true, disables the CORS policy. The default value is false, which indicates that the CORS policy is in effect. Corresponds to the JSON property disabled

Returns:

  • (Boolean)


6133
6134
6135
# File 'lib/google/apis/compute_v1/classes.rb', line 6133

def disabled
  @disabled
end

#expose_headersArray<String>

Specifies the content for the Access-Control-Expose-Headers header. Corresponds to the JSON property exposeHeaders

Returns:

  • (Array<String>)


6139
6140
6141
# File 'lib/google/apis/compute_v1/classes.rb', line 6139

def expose_headers
  @expose_headers
end

#max_ageFixnum

Specifies how long results of a preflight request can be cached in seconds. This field translates to the Access-Control-Max-Age header. Corresponds to the JSON property maxAge

Returns:

  • (Fixnum)


6145
6146
6147
# File 'lib/google/apis/compute_v1/classes.rb', line 6145

def max_age
  @max_age
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
# File 'lib/google/apis/compute_v1/classes.rb', line 6152

def update!(**args)
  @allow_credentials = args[:allow_credentials] if args.key?(:allow_credentials)
  @allow_headers = args[:allow_headers] if args.key?(:allow_headers)
  @allow_methods = args[:allow_methods] if args.key?(:allow_methods)
  @allow_origin_regexes = args[:allow_origin_regexes] if args.key?(:allow_origin_regexes)
  @allow_origins = args[:allow_origins] if args.key?(:allow_origins)
  @disabled = args[:disabled] if args.key?(:disabled)
  @expose_headers = args[:expose_headers] if args.key?(:expose_headers)
  @max_age = args[:max_age] if args.key?(:max_age)
end