com.azure.resourcemanager.security.models.ServicePrincipalProperties Maven / Gradle / Ivy
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.security.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 java.io.IOException;
/**
* Details of the service principal.
*/
@Fluent
public final class ServicePrincipalProperties implements JsonSerializable {
/*
* Application ID of service principal.
*/
private String applicationId;
/*
* A secret string that the application uses to prove its identity, also can be referred to as application password
* (write only).
*/
private String secret;
/**
* Creates an instance of ServicePrincipalProperties class.
*/
public ServicePrincipalProperties() {
}
/**
* Get the applicationId property: Application ID of service principal.
*
* @return the applicationId value.
*/
public String applicationId() {
return this.applicationId;
}
/**
* Set the applicationId property: Application ID of service principal.
*
* @param applicationId the applicationId value to set.
* @return the ServicePrincipalProperties object itself.
*/
public ServicePrincipalProperties withApplicationId(String applicationId) {
this.applicationId = applicationId;
return this;
}
/**
* Get the secret property: A secret string that the application uses to prove its identity, also can be referred to
* as application password (write only).
*
* @return the secret value.
*/
public String secret() {
return this.secret;
}
/**
* Set the secret property: A secret string that the application uses to prove its identity, also can be referred to
* as application password (write only).
*
* @param secret the secret value to set.
* @return the ServicePrincipalProperties object itself.
*/
public ServicePrincipalProperties withSecret(String secret) {
this.secret = secret;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("applicationId", this.applicationId);
jsonWriter.writeStringField("secret", this.secret);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ServicePrincipalProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ServicePrincipalProperties 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 ServicePrincipalProperties.
*/
public static ServicePrincipalProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ServicePrincipalProperties deserializedServicePrincipalProperties = new ServicePrincipalProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("applicationId".equals(fieldName)) {
deserializedServicePrincipalProperties.applicationId = reader.getString();
} else if ("secret".equals(fieldName)) {
deserializedServicePrincipalProperties.secret = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedServicePrincipalProperties;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy