Class OAuthRequirements.Builder (2.25.0)

public static final class OAuthRequirements.Builder extends GeneratedMessageV3.Builder<OAuthRequirements.Builder> implements OAuthRequirementsOrBuilder

OAuth scopes are a way to define data and permissions on data. For example, there are scopes defined for "Read-only access to Google Calendar" and "Access to Cloud Platform". Users can consent to a scope for an application, giving it permission to access that data on their behalf.

OAuth scope specifications should be fairly coarse grained; a user will need to see and understand the text description of what your scope means.

In most cases: use one or at most two OAuth scopes for an entire family of products. If your product has multiple APIs, you should probably be sharing the OAuth scope across all of those APIs.

When you need finer grained OAuth consent screens: talk with your product management about how developers will use them in practice.

Please note that even though each of the canonical scopes is enough for a request to be accepted and passed to the backend, a request can still fail due to the backend requiring additional scopes or permissions.

Protobuf type google.api.OAuthRequirements

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
TypeDescription
Descriptor

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public OAuthRequirements.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
OAuthRequirements.Builder
Overrides

build()

public OAuthRequirements build()
Returns
TypeDescription
OAuthRequirements

buildPartial()

public OAuthRequirements buildPartial()
Returns
TypeDescription
OAuthRequirements

clear()

public OAuthRequirements.Builder clear()
Returns
TypeDescription
OAuthRequirements.Builder
Overrides

clearCanonicalScopes()

public OAuthRequirements.Builder clearCanonicalScopes()

The list of publicly documented OAuth scopes that are allowed access. An OAuth token containing any of these scopes will be accepted.

Example:

  canonical_scopes: https://www.googleapis.com/auth/calendar,
                    https://www.googleapis.com/auth/calendar.read

string canonical_scopes = 1;

Returns
TypeDescription
OAuthRequirements.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

public OAuthRequirements.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
NameDescription
fieldFieldDescriptor
Returns
TypeDescription
OAuthRequirements.Builder
Overrides

clearOneof(Descriptors.OneofDescriptor oneof)

public OAuthRequirements.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
NameDescription
oneofOneofDescriptor
Returns
TypeDescription
OAuthRequirements.Builder
Overrides

clone()

public OAuthRequirements.Builder clone()
Returns
TypeDescription
OAuthRequirements.Builder
Overrides

getCanonicalScopes()

public String getCanonicalScopes()

The list of publicly documented OAuth scopes that are allowed access. An OAuth token containing any of these scopes will be accepted.

Example:

  canonical_scopes: https://www.googleapis.com/auth/calendar,
                    https://www.googleapis.com/auth/calendar.read

string canonical_scopes = 1;

Returns
TypeDescription
String

The canonicalScopes.

getCanonicalScopesBytes()

public ByteString getCanonicalScopesBytes()

The list of publicly documented OAuth scopes that are allowed access. An OAuth token containing any of these scopes will be accepted.

Example:

  canonical_scopes: https://www.googleapis.com/auth/calendar,
                    https://www.googleapis.com/auth/calendar.read

string canonical_scopes = 1;

Returns
TypeDescription
ByteString

The bytes for canonicalScopes.

getDefaultInstanceForType()

public OAuthRequirements getDefaultInstanceForType()
Returns
TypeDescription
OAuthRequirements

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
TypeDescription
Descriptor
Overrides

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

mergeFrom(OAuthRequirements other)

public OAuthRequirements.Builder mergeFrom(OAuthRequirements other)
Parameter
NameDescription
otherOAuthRequirements
Returns
TypeDescription
OAuthRequirements.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public OAuthRequirements.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
OAuthRequirements.Builder
Overrides
Exceptions
TypeDescription
IOException

mergeFrom(Message other)

public OAuthRequirements.Builder mergeFrom(Message other)
Parameter
NameDescription
otherMessage
Returns
TypeDescription
OAuthRequirements.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

public final OAuthRequirements.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
OAuthRequirements.Builder
Overrides

setCanonicalScopes(String value)

public OAuthRequirements.Builder setCanonicalScopes(String value)

The list of publicly documented OAuth scopes that are allowed access. An OAuth token containing any of these scopes will be accepted.

Example:

  canonical_scopes: https://www.googleapis.com/auth/calendar,
                    https://www.googleapis.com/auth/calendar.read

string canonical_scopes = 1;

Parameter
NameDescription
valueString

The canonicalScopes to set.

Returns
TypeDescription
OAuthRequirements.Builder

This builder for chaining.

setCanonicalScopesBytes(ByteString value)

public OAuthRequirements.Builder setCanonicalScopesBytes(ByteString value)

The list of publicly documented OAuth scopes that are allowed access. An OAuth token containing any of these scopes will be accepted.

Example:

  canonical_scopes: https://www.googleapis.com/auth/calendar,
                    https://www.googleapis.com/auth/calendar.read

string canonical_scopes = 1;

Parameter
NameDescription
valueByteString

The bytes for canonicalScopes to set.

Returns
TypeDescription
OAuthRequirements.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

public OAuthRequirements.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
OAuthRequirements.Builder
Overrides

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

public OAuthRequirements.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
NameDescription
fieldFieldDescriptor
indexint
valueObject
Returns
TypeDescription
OAuthRequirements.Builder
Overrides

setUnknownFields(UnknownFieldSet unknownFields)

public final OAuthRequirements.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
OAuthRequirements.Builder
Overrides