co.elastic.clients.elasticsearch.xpack.usage.Realm Maven / Gradle / Ivy
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package co.elastic.clients.elasticsearch.xpack.usage;
import co.elastic.clients.json.JsonpDeserializable;
import co.elastic.clients.json.JsonpDeserializer;
import co.elastic.clients.json.JsonpMapper;
import co.elastic.clients.json.ObjectBuilderDeserializer;
import co.elastic.clients.json.ObjectDeserializer;
import co.elastic.clients.util.ApiTypeHelper;
import co.elastic.clients.util.ObjectBuilder;
import jakarta.json.stream.JsonGenerator;
import java.lang.Boolean;
import java.lang.Long;
import java.lang.String;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
import javax.annotation.Nullable;
//----------------------------------------------------------------
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------------------
//
// This code is generated from the Elasticsearch API specification
// at https://github.com/elastic/elasticsearch-specification
//
// Manual updates to this file will be lost when the code is
// re-generated.
//
// If you find a property that is missing or wrongly typed, please
// open an issue or a PR on the API specification repository.
//
//----------------------------------------------------------------
// typedef: xpack.usage.Realm
/**
*
* @see API
* specification
*/
@JsonpDeserializable
public class Realm extends Base {
private final List name;
private final List order;
private final List size;
private final List cache;
private final List hasAuthorizationRealms;
private final List hasDefaultUsernamePattern;
private final List hasTruststore;
private final List isAuthenticationDelegated;
// ---------------------------------------------------------------------------------------------
private Realm(Builder builder) {
super(builder);
this.name = ApiTypeHelper.unmodifiable(builder.name);
this.order = ApiTypeHelper.unmodifiable(builder.order);
this.size = ApiTypeHelper.unmodifiable(builder.size);
this.cache = ApiTypeHelper.unmodifiable(builder.cache);
this.hasAuthorizationRealms = ApiTypeHelper.unmodifiable(builder.hasAuthorizationRealms);
this.hasDefaultUsernamePattern = ApiTypeHelper.unmodifiable(builder.hasDefaultUsernamePattern);
this.hasTruststore = ApiTypeHelper.unmodifiable(builder.hasTruststore);
this.isAuthenticationDelegated = ApiTypeHelper.unmodifiable(builder.isAuthenticationDelegated);
}
public static Realm of(Function> fn) {
return fn.apply(new Builder()).build();
}
/**
* API name: {@code name}
*/
public final List name() {
return this.name;
}
/**
* API name: {@code order}
*/
public final List order() {
return this.order;
}
/**
* API name: {@code size}
*/
public final List size() {
return this.size;
}
/**
* API name: {@code cache}
*/
public final List cache() {
return this.cache;
}
/**
* API name: {@code has_authorization_realms}
*/
public final List hasAuthorizationRealms() {
return this.hasAuthorizationRealms;
}
/**
* API name: {@code has_default_username_pattern}
*/
public final List hasDefaultUsernamePattern() {
return this.hasDefaultUsernamePattern;
}
/**
* API name: {@code has_truststore}
*/
public final List hasTruststore() {
return this.hasTruststore;
}
/**
* API name: {@code is_authentication_delegated}
*/
public final List isAuthenticationDelegated() {
return this.isAuthenticationDelegated;
}
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
super.serializeInternal(generator, mapper);
if (ApiTypeHelper.isDefined(this.name)) {
generator.writeKey("name");
generator.writeStartArray();
for (String item0 : this.name) {
generator.write(item0);
}
generator.writeEnd();
}
if (ApiTypeHelper.isDefined(this.order)) {
generator.writeKey("order");
generator.writeStartArray();
for (Long item0 : this.order) {
generator.write(item0);
}
generator.writeEnd();
}
if (ApiTypeHelper.isDefined(this.size)) {
generator.writeKey("size");
generator.writeStartArray();
for (Long item0 : this.size) {
generator.write(item0);
}
generator.writeEnd();
}
if (ApiTypeHelper.isDefined(this.cache)) {
generator.writeKey("cache");
generator.writeStartArray();
for (RealmCache item0 : this.cache) {
item0.serialize(generator, mapper);
}
generator.writeEnd();
}
if (ApiTypeHelper.isDefined(this.hasAuthorizationRealms)) {
generator.writeKey("has_authorization_realms");
generator.writeStartArray();
for (Boolean item0 : this.hasAuthorizationRealms) {
generator.write(item0);
}
generator.writeEnd();
}
if (ApiTypeHelper.isDefined(this.hasDefaultUsernamePattern)) {
generator.writeKey("has_default_username_pattern");
generator.writeStartArray();
for (Boolean item0 : this.hasDefaultUsernamePattern) {
generator.write(item0);
}
generator.writeEnd();
}
if (ApiTypeHelper.isDefined(this.hasTruststore)) {
generator.writeKey("has_truststore");
generator.writeStartArray();
for (Boolean item0 : this.hasTruststore) {
generator.write(item0);
}
generator.writeEnd();
}
if (ApiTypeHelper.isDefined(this.isAuthenticationDelegated)) {
generator.writeKey("is_authentication_delegated");
generator.writeStartArray();
for (Boolean item0 : this.isAuthenticationDelegated) {
generator.write(item0);
}
generator.writeEnd();
}
}
// ---------------------------------------------------------------------------------------------
/**
* Builder for {@link Realm}.
*/
public static class Builder extends Base.AbstractBuilder implements ObjectBuilder {
@Nullable
private List name;
@Nullable
private List order;
@Nullable
private List size;
@Nullable
private List cache;
@Nullable
private List hasAuthorizationRealms;
@Nullable
private List hasDefaultUsernamePattern;
@Nullable
private List hasTruststore;
@Nullable
private List isAuthenticationDelegated;
/**
* API name: {@code name}
*
* Adds all elements of list
to name
.
*/
public final Builder name(List list) {
this.name = _listAddAll(this.name, list);
return this;
}
/**
* API name: {@code name}
*
* Adds one or more values to name
.
*/
public final Builder name(String value, String... values) {
this.name = _listAdd(this.name, value, values);
return this;
}
/**
* API name: {@code order}
*
* Adds all elements of list
to order
.
*/
public final Builder order(List list) {
this.order = _listAddAll(this.order, list);
return this;
}
/**
* API name: {@code order}
*
* Adds one or more values to order
.
*/
public final Builder order(Long value, Long... values) {
this.order = _listAdd(this.order, value, values);
return this;
}
/**
* API name: {@code size}
*
* Adds all elements of list
to size
.
*/
public final Builder size(List list) {
this.size = _listAddAll(this.size, list);
return this;
}
/**
* API name: {@code size}
*
* Adds one or more values to size
.
*/
public final Builder size(Long value, Long... values) {
this.size = _listAdd(this.size, value, values);
return this;
}
/**
* API name: {@code cache}
*
* Adds all elements of list
to cache
.
*/
public final Builder cache(List list) {
this.cache = _listAddAll(this.cache, list);
return this;
}
/**
* API name: {@code cache}
*
* Adds one or more values to cache
.
*/
public final Builder cache(RealmCache value, RealmCache... values) {
this.cache = _listAdd(this.cache, value, values);
return this;
}
/**
* API name: {@code cache}
*
* Adds a value to cache
using a builder lambda.
*/
public final Builder cache(Function> fn) {
return cache(fn.apply(new RealmCache.Builder()).build());
}
/**
* API name: {@code has_authorization_realms}
*
* Adds all elements of list
to
* hasAuthorizationRealms
.
*/
public final Builder hasAuthorizationRealms(List list) {
this.hasAuthorizationRealms = _listAddAll(this.hasAuthorizationRealms, list);
return this;
}
/**
* API name: {@code has_authorization_realms}
*
* Adds one or more values to hasAuthorizationRealms
.
*/
public final Builder hasAuthorizationRealms(Boolean value, Boolean... values) {
this.hasAuthorizationRealms = _listAdd(this.hasAuthorizationRealms, value, values);
return this;
}
/**
* API name: {@code has_default_username_pattern}
*
* Adds all elements of list
to
* hasDefaultUsernamePattern
.
*/
public final Builder hasDefaultUsernamePattern(List list) {
this.hasDefaultUsernamePattern = _listAddAll(this.hasDefaultUsernamePattern, list);
return this;
}
/**
* API name: {@code has_default_username_pattern}
*
* Adds one or more values to hasDefaultUsernamePattern
.
*/
public final Builder hasDefaultUsernamePattern(Boolean value, Boolean... values) {
this.hasDefaultUsernamePattern = _listAdd(this.hasDefaultUsernamePattern, value, values);
return this;
}
/**
* API name: {@code has_truststore}
*
* Adds all elements of list
to hasTruststore
.
*/
public final Builder hasTruststore(List list) {
this.hasTruststore = _listAddAll(this.hasTruststore, list);
return this;
}
/**
* API name: {@code has_truststore}
*
* Adds one or more values to hasTruststore
.
*/
public final Builder hasTruststore(Boolean value, Boolean... values) {
this.hasTruststore = _listAdd(this.hasTruststore, value, values);
return this;
}
/**
* API name: {@code is_authentication_delegated}
*
* Adds all elements of list
to
* isAuthenticationDelegated
.
*/
public final Builder isAuthenticationDelegated(List list) {
this.isAuthenticationDelegated = _listAddAll(this.isAuthenticationDelegated, list);
return this;
}
/**
* API name: {@code is_authentication_delegated}
*
* Adds one or more values to isAuthenticationDelegated
.
*/
public final Builder isAuthenticationDelegated(Boolean value, Boolean... values) {
this.isAuthenticationDelegated = _listAdd(this.isAuthenticationDelegated, value, values);
return this;
}
@Override
protected Builder self() {
return this;
}
/**
* Builds a {@link Realm}.
*
* @throws NullPointerException
* if some of the required fields are null.
*/
public Realm build() {
_checkSingleUse();
return new Realm(this);
}
}
// ---------------------------------------------------------------------------------------------
/**
* Json deserializer for {@link Realm}
*/
public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new,
Realm::setupRealmDeserializer);
protected static void setupRealmDeserializer(ObjectDeserializer op) {
Base.setupBaseDeserializer(op);
op.add(Builder::name, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "name");
op.add(Builder::order, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.longDeserializer()), "order");
op.add(Builder::size, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.longDeserializer()), "size");
op.add(Builder::cache, JsonpDeserializer.arrayDeserializer(RealmCache._DESERIALIZER), "cache");
op.add(Builder::hasAuthorizationRealms,
JsonpDeserializer.arrayDeserializer(JsonpDeserializer.booleanDeserializer()),
"has_authorization_realms");
op.add(Builder::hasDefaultUsernamePattern,
JsonpDeserializer.arrayDeserializer(JsonpDeserializer.booleanDeserializer()),
"has_default_username_pattern");
op.add(Builder::hasTruststore, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.booleanDeserializer()),
"has_truststore");
op.add(Builder::isAuthenticationDelegated,
JsonpDeserializer.arrayDeserializer(JsonpDeserializer.booleanDeserializer()),
"is_authentication_delegated");
}
}