CorsRule Class

  • java.lang.Object
    • com.azure.resourcemanager.storage.models.CorsRule

Implements

public final class CorsRule
implements JsonSerializable<CorsRule>

Specifies a CORS rule for the Blob service.

Constructor Summary

Constructor Description
CorsRule()

Creates an instance of CorsRule class.

Method Summary

Modifier and Type Method and Description
List<String> allowedHeaders()

Get the allowedHeaders property: Required if CorsRule element is present.

List<CorsRuleAllowedMethodsItem> allowedMethods()

Get the allowedMethods property: Required if CorsRule element is present.

List<String> allowedOrigins()

Get the allowedOrigins property: Required if CorsRule element is present.

List<String> exposedHeaders()

Get the exposedHeaders property: Required if CorsRule element is present.

static CorsRule fromJson(JsonReader jsonReader)

Reads an instance of CorsRule from the JsonReader.

int maxAgeInSeconds()

Get the maxAgeInSeconds property: Required if CorsRule element is present.

JsonWriter toJson(JsonWriter jsonWriter)
void validate()

Validates the instance.

CorsRule withAllowedHeaders(List<String> allowedHeaders)

Set the allowedHeaders property: Required if CorsRule element is present.

CorsRule withAllowedMethods(List<CorsRuleAllowedMethodsItem> allowedMethods)

Set the allowedMethods property: Required if CorsRule element is present.

CorsRule withAllowedOrigins(List<String> allowedOrigins)

Set the allowedOrigins property: Required if CorsRule element is present.

CorsRule withExposedHeaders(List<String> exposedHeaders)

Set the exposedHeaders property: Required if CorsRule element is present.

CorsRule withMaxAgeInSeconds(int maxAgeInSeconds)

Set the maxAgeInSeconds property: Required if CorsRule element is present.

Methods inherited from java.lang.Object

Constructor Details

CorsRule

public CorsRule()

Creates an instance of CorsRule class.

Method Details

allowedHeaders

public List allowedHeaders()

Get the allowedHeaders property: Required if CorsRule element is present. A list of headers allowed to be part of the cross-origin request.

Returns:

the allowedHeaders value.

allowedMethods

public List allowedMethods()

Get the allowedMethods property: Required if CorsRule element is present. A list of HTTP methods that are allowed to be executed by the origin.

Returns:

the allowedMethods value.

allowedOrigins

public List allowedOrigins()

Get the allowedOrigins property: Required if CorsRule element is present. A list of origin domains that will be allowed via CORS, or "*" to allow all domains.

Returns:

the allowedOrigins value.

exposedHeaders

public List exposedHeaders()

Get the exposedHeaders property: Required if CorsRule element is present. A list of response headers to expose to CORS clients.

Returns:

the exposedHeaders value.

fromJson

public static CorsRule fromJson(JsonReader jsonReader)

Reads an instance of CorsRule from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of CorsRule if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If the deserialized JSON object was missing any required properties.

maxAgeInSeconds

public int maxAgeInSeconds()

Get the maxAgeInSeconds property: Required if CorsRule element is present. The number of seconds that the client/browser should cache a preflight response.

Returns:

the maxAgeInSeconds value.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

validate

public void validate()

Validates the instance.

withAllowedHeaders

public CorsRule withAllowedHeaders(List allowedHeaders)

Set the allowedHeaders property: Required if CorsRule element is present. A list of headers allowed to be part of the cross-origin request.

Parameters:

allowedHeaders - the allowedHeaders value to set.

Returns:

the CorsRule object itself.

withAllowedMethods

public CorsRule withAllowedMethods(List allowedMethods)

Set the allowedMethods property: Required if CorsRule element is present. A list of HTTP methods that are allowed to be executed by the origin.

Parameters:

allowedMethods - the allowedMethods value to set.

Returns:

the CorsRule object itself.

withAllowedOrigins

public CorsRule withAllowedOrigins(List allowedOrigins)

Set the allowedOrigins property: Required if CorsRule element is present. A list of origin domains that will be allowed via CORS, or "*" to allow all domains.

Parameters:

allowedOrigins - the allowedOrigins value to set.

Returns:

the CorsRule object itself.

withExposedHeaders

public CorsRule withExposedHeaders(List exposedHeaders)

Set the exposedHeaders property: Required if CorsRule element is present. A list of response headers to expose to CORS clients.

Parameters:

exposedHeaders - the exposedHeaders value to set.

Returns:

the CorsRule object itself.

withMaxAgeInSeconds

public CorsRule withMaxAgeInSeconds(int maxAgeInSeconds)

Set the maxAgeInSeconds property: Required if CorsRule element is present. The number of seconds that the client/browser should cache a preflight response.

Parameters:

maxAgeInSeconds - the maxAgeInSeconds value to set.

Returns:

the CorsRule object itself.

Applies to