com.azure.resourcemanager.cosmos.models.MongoUserDefinitionCreateUpdateParameters Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-cosmos Show documentation
Show all versions of azure-resourcemanager-cosmos Show documentation
This package contains Microsoft Azure CosmosDB SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.cosmos.models;
import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.cosmos.fluent.models.MongoUserDefinitionResource;
import java.io.IOException;
import java.util.List;
/**
* Parameters to create and update an Azure Cosmos DB Mongo User Definition.
*/
@Fluent
public final class MongoUserDefinitionCreateUpdateParameters
implements JsonSerializable {
/*
* Properties to create and update an Azure Cosmos DB Mongo User Definition.
*/
private MongoUserDefinitionResource innerProperties;
/**
* Creates an instance of MongoUserDefinitionCreateUpdateParameters class.
*/
public MongoUserDefinitionCreateUpdateParameters() {
}
/**
* Get the innerProperties property: Properties to create and update an Azure Cosmos DB Mongo User Definition.
*
* @return the innerProperties value.
*/
private MongoUserDefinitionResource innerProperties() {
return this.innerProperties;
}
/**
* Get the username property: The user name for User Definition.
*
* @return the username value.
*/
public String username() {
return this.innerProperties() == null ? null : this.innerProperties().username();
}
/**
* Set the username property: The user name for User Definition.
*
* @param username the username value to set.
* @return the MongoUserDefinitionCreateUpdateParameters object itself.
*/
public MongoUserDefinitionCreateUpdateParameters withUsername(String username) {
if (this.innerProperties() == null) {
this.innerProperties = new MongoUserDefinitionResource();
}
this.innerProperties().withUsername(username);
return this;
}
/**
* Get the password property: The password for User Definition. Response does not contain user password.
*
* @return the password value.
*/
public String password() {
return this.innerProperties() == null ? null : this.innerProperties().password();
}
/**
* Set the password property: The password for User Definition. Response does not contain user password.
*
* @param password the password value to set.
* @return the MongoUserDefinitionCreateUpdateParameters object itself.
*/
public MongoUserDefinitionCreateUpdateParameters withPassword(String password) {
if (this.innerProperties() == null) {
this.innerProperties = new MongoUserDefinitionResource();
}
this.innerProperties().withPassword(password);
return this;
}
/**
* Get the databaseName property: The database name for which access is being granted for this User Definition.
*
* @return the databaseName value.
*/
public String databaseName() {
return this.innerProperties() == null ? null : this.innerProperties().databaseName();
}
/**
* Set the databaseName property: The database name for which access is being granted for this User Definition.
*
* @param databaseName the databaseName value to set.
* @return the MongoUserDefinitionCreateUpdateParameters object itself.
*/
public MongoUserDefinitionCreateUpdateParameters withDatabaseName(String databaseName) {
if (this.innerProperties() == null) {
this.innerProperties = new MongoUserDefinitionResource();
}
this.innerProperties().withDatabaseName(databaseName);
return this;
}
/**
* Get the customData property: A custom definition for the USer Definition.
*
* @return the customData value.
*/
public String customData() {
return this.innerProperties() == null ? null : this.innerProperties().customData();
}
/**
* Set the customData property: A custom definition for the USer Definition.
*
* @param customData the customData value to set.
* @return the MongoUserDefinitionCreateUpdateParameters object itself.
*/
public MongoUserDefinitionCreateUpdateParameters withCustomData(String customData) {
if (this.innerProperties() == null) {
this.innerProperties = new MongoUserDefinitionResource();
}
this.innerProperties().withCustomData(customData);
return this;
}
/**
* Get the roles property: The set of roles inherited by the User Definition.
*
* @return the roles value.
*/
public List roles() {
return this.innerProperties() == null ? null : this.innerProperties().roles();
}
/**
* Set the roles property: The set of roles inherited by the User Definition.
*
* @param roles the roles value to set.
* @return the MongoUserDefinitionCreateUpdateParameters object itself.
*/
public MongoUserDefinitionCreateUpdateParameters withRoles(List roles) {
if (this.innerProperties() == null) {
this.innerProperties = new MongoUserDefinitionResource();
}
this.innerProperties().withRoles(roles);
return this;
}
/**
* Get the mechanisms property: The Mongo Auth mechanism. For now, we only support auth mechanism SCRAM-SHA-256.
*
* @return the mechanisms value.
*/
public String mechanisms() {
return this.innerProperties() == null ? null : this.innerProperties().mechanisms();
}
/**
* Set the mechanisms property: The Mongo Auth mechanism. For now, we only support auth mechanism SCRAM-SHA-256.
*
* @param mechanisms the mechanisms value to set.
* @return the MongoUserDefinitionCreateUpdateParameters object itself.
*/
public MongoUserDefinitionCreateUpdateParameters withMechanisms(String mechanisms) {
if (this.innerProperties() == null) {
this.innerProperties = new MongoUserDefinitionResource();
}
this.innerProperties().withMechanisms(mechanisms);
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (innerProperties() != null) {
innerProperties().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("properties", this.innerProperties);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of MongoUserDefinitionCreateUpdateParameters from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of MongoUserDefinitionCreateUpdateParameters if the JsonReader was pointing to an instance of
* it, or null if it was pointing to JSON null.
* @throws IOException If an error occurs while reading the MongoUserDefinitionCreateUpdateParameters.
*/
public static MongoUserDefinitionCreateUpdateParameters fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
MongoUserDefinitionCreateUpdateParameters deserializedMongoUserDefinitionCreateUpdateParameters
= new MongoUserDefinitionCreateUpdateParameters();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("properties".equals(fieldName)) {
deserializedMongoUserDefinitionCreateUpdateParameters.innerProperties
= MongoUserDefinitionResource.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedMongoUserDefinitionCreateUpdateParameters;
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy