com.google.api.AuthenticationRuleKt.kt Maven / Gradle / Ivy
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/api/auth.proto
// Generated files should ignore deprecation warnings
@file:Suppress("DEPRECATION")
package com.google.api;
@kotlin.jvm.JvmName("-initializeauthenticationRule")
public inline fun authenticationRule(block: com.google.api.AuthenticationRuleKt.Dsl.() -> kotlin.Unit): com.google.api.AuthenticationRule =
com.google.api.AuthenticationRuleKt.Dsl._create(com.google.api.AuthenticationRule.newBuilder()).apply { block() }._build()
/**
* ```
* Authentication rules for the service.
*
* By default, if a method has any authentication requirements, every request
* must include a valid credential matching one of the requirements.
* It's an error to include more than one kind of credential in a single
* request.
*
* If a method doesn't have any auth requirements, request credentials will be
* ignored.
* ```
*
* Protobuf type `google.api.AuthenticationRule`
*/
public object AuthenticationRuleKt {
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
@com.google.protobuf.kotlin.ProtoDslMarker
public class Dsl private constructor(
private val _builder: com.google.api.AuthenticationRule.Builder
) {
public companion object {
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _create(builder: com.google.api.AuthenticationRule.Builder): Dsl = Dsl(builder)
}
@kotlin.jvm.JvmSynthetic
@kotlin.PublishedApi
internal fun _build(): com.google.api.AuthenticationRule = _builder.build()
/**
* ```
* Selects the methods to which this rule applies.
*
* Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
* ```
*
* `string selector = 1;`
*/
public var selector: kotlin.String
@JvmName("getSelector")
get() = _builder.getSelector()
@JvmName("setSelector")
set(value) {
_builder.setSelector(value)
}
/**
* ```
* Selects the methods to which this rule applies.
*
* Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
* ```
*
* `string selector = 1;`
*/
public fun clearSelector() {
_builder.clearSelector()
}
/**
* ```
* The requirements for OAuth credentials.
* ```
*
* `.google.api.OAuthRequirements oauth = 2;`
*/
public var oauth: com.google.api.OAuthRequirements
@JvmName("getOauth")
get() = _builder.getOauth()
@JvmName("setOauth")
set(value) {
_builder.setOauth(value)
}
/**
* ```
* The requirements for OAuth credentials.
* ```
*
* `.google.api.OAuthRequirements oauth = 2;`
*/
public fun clearOauth() {
_builder.clearOauth()
}
/**
* ```
* The requirements for OAuth credentials.
* ```
*
* `.google.api.OAuthRequirements oauth = 2;`
* @return Whether the oauth field is set.
*/
public fun hasOauth(): kotlin.Boolean {
return _builder.hasOauth()
}
/**
* ```
* If true, the service accepts API keys without any other credential.
* ```
*
* `bool allow_without_credential = 5;`
*/
public var allowWithoutCredential: kotlin.Boolean
@JvmName("getAllowWithoutCredential")
get() = _builder.getAllowWithoutCredential()
@JvmName("setAllowWithoutCredential")
set(value) {
_builder.setAllowWithoutCredential(value)
}
/**
* ```
* If true, the service accepts API keys without any other credential.
* ```
*
* `bool allow_without_credential = 5;`
*/
public fun clearAllowWithoutCredential() {
_builder.clearAllowWithoutCredential()
}
/**
* An uninstantiable, behaviorless type to represent the field in
* generics.
*/
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
public class RequirementsProxy private constructor() : com.google.protobuf.kotlin.DslProxy()
/**
* ```
* Requirements for additional authentication providers.
* ```
*
* `repeated .google.api.AuthRequirement requirements = 7;`
*/
public val requirements: com.google.protobuf.kotlin.DslList
@kotlin.jvm.JvmSynthetic
get() = com.google.protobuf.kotlin.DslList(
_builder.getRequirementsList()
)
/**
* ```
* Requirements for additional authentication providers.
* ```
*
* `repeated .google.api.AuthRequirement requirements = 7;`
* @param value The requirements to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("addRequirements")
public fun com.google.protobuf.kotlin.DslList.add(value: com.google.api.AuthRequirement) {
_builder.addRequirements(value)
}
/**
* ```
* Requirements for additional authentication providers.
* ```
*
* `repeated .google.api.AuthRequirement requirements = 7;`
* @param value The requirements to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("plusAssignRequirements")
@Suppress("NOTHING_TO_INLINE")
public inline operator fun com.google.protobuf.kotlin.DslList.plusAssign(value: com.google.api.AuthRequirement) {
add(value)
}
/**
* ```
* Requirements for additional authentication providers.
* ```
*
* `repeated .google.api.AuthRequirement requirements = 7;`
* @param values The requirements to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("addAllRequirements")
public fun com.google.protobuf.kotlin.DslList.addAll(values: kotlin.collections.Iterable) {
_builder.addAllRequirements(values)
}
/**
* ```
* Requirements for additional authentication providers.
* ```
*
* `repeated .google.api.AuthRequirement requirements = 7;`
* @param values The requirements to add.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("plusAssignAllRequirements")
@Suppress("NOTHING_TO_INLINE")
public inline operator fun com.google.protobuf.kotlin.DslList.plusAssign(values: kotlin.collections.Iterable) {
addAll(values)
}
/**
* ```
* Requirements for additional authentication providers.
* ```
*
* `repeated .google.api.AuthRequirement requirements = 7;`
* @param index The index to set the value at.
* @param value The requirements to set.
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("setRequirements")
public operator fun com.google.protobuf.kotlin.DslList.set(index: kotlin.Int, value: com.google.api.AuthRequirement) {
_builder.setRequirements(index, value)
}
/**
* ```
* Requirements for additional authentication providers.
* ```
*
* `repeated .google.api.AuthRequirement requirements = 7;`
*/
@kotlin.jvm.JvmSynthetic
@kotlin.jvm.JvmName("clearRequirements")
public fun com.google.protobuf.kotlin.DslList.clear() {
_builder.clearRequirements()
}
}
}
@kotlin.jvm.JvmSynthetic
public inline fun com.google.api.AuthenticationRule.copy(block: `com.google.api`.AuthenticationRuleKt.Dsl.() -> kotlin.Unit): com.google.api.AuthenticationRule =
`com.google.api`.AuthenticationRuleKt.Dsl._create(this.toBuilder()).apply { block() }._build()
public val com.google.api.AuthenticationRuleOrBuilder.oauthOrNull: com.google.api.OAuthRequirements?
get() = if (hasOauth()) getOauth() else null