com.azure.resourcemanager.security.models.AuthenticationDetailsProperties 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.Immutable;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.List;
/**
* Settings for cloud authentication management.
*/
@Immutable
public class AuthenticationDetailsProperties implements JsonSerializable {
/*
* Connect to your cloud account, for AWS use either account credentials or role-based authentication. For GCP use
* account organization credentials.
*/
private AuthenticationType authenticationType = AuthenticationType.fromString("AuthenticationDetailsProperties");
/*
* State of the multi-cloud connector
*/
private AuthenticationProvisioningState authenticationProvisioningState;
/*
* The permissions detected in the cloud account.
*/
private List grantedPermissions;
/**
* Creates an instance of AuthenticationDetailsProperties class.
*/
public AuthenticationDetailsProperties() {
}
/**
* Get the authenticationType property: Connect to your cloud account, for AWS use either account credentials or
* role-based authentication. For GCP use account organization credentials.
*
* @return the authenticationType value.
*/
public AuthenticationType authenticationType() {
return this.authenticationType;
}
/**
* Get the authenticationProvisioningState property: State of the multi-cloud connector.
*
* @return the authenticationProvisioningState value.
*/
public AuthenticationProvisioningState authenticationProvisioningState() {
return this.authenticationProvisioningState;
}
/**
* Set the authenticationProvisioningState property: State of the multi-cloud connector.
*
* @param authenticationProvisioningState the authenticationProvisioningState value to set.
* @return the AuthenticationDetailsProperties object itself.
*/
AuthenticationDetailsProperties
withAuthenticationProvisioningState(AuthenticationProvisioningState authenticationProvisioningState) {
this.authenticationProvisioningState = authenticationProvisioningState;
return this;
}
/**
* Get the grantedPermissions property: The permissions detected in the cloud account.
*
* @return the grantedPermissions value.
*/
public List grantedPermissions() {
return this.grantedPermissions;
}
/**
* Set the grantedPermissions property: The permissions detected in the cloud account.
*
* @param grantedPermissions the grantedPermissions value to set.
* @return the AuthenticationDetailsProperties object itself.
*/
AuthenticationDetailsProperties withGrantedPermissions(List grantedPermissions) {
this.grantedPermissions = grantedPermissions;
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("authenticationType",
this.authenticationType == null ? null : this.authenticationType.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of AuthenticationDetailsProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AuthenticationDetailsProperties 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 AuthenticationDetailsProperties.
*/
public static AuthenticationDetailsProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
String discriminatorValue = null;
try (JsonReader readerToUse = reader.bufferObject()) {
readerToUse.nextToken(); // Prepare for reading
while (readerToUse.nextToken() != JsonToken.END_OBJECT) {
String fieldName = readerToUse.getFieldName();
readerToUse.nextToken();
if ("authenticationType".equals(fieldName)) {
discriminatorValue = readerToUse.getString();
break;
} else {
readerToUse.skipChildren();
}
}
// Use the discriminator value to determine which subtype should be deserialized.
if ("awsCreds".equals(discriminatorValue)) {
return AwsCredsAuthenticationDetailsProperties.fromJson(readerToUse.reset());
} else if ("awsAssumeRole".equals(discriminatorValue)) {
return AwAssumeRoleAuthenticationDetailsProperties.fromJson(readerToUse.reset());
} else if ("gcpCredentials".equals(discriminatorValue)) {
return GcpCredentialsDetailsProperties.fromJson(readerToUse.reset());
} else {
return fromJsonKnownDiscriminator(readerToUse.reset());
}
}
});
}
static AuthenticationDetailsProperties fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
AuthenticationDetailsProperties deserializedAuthenticationDetailsProperties
= new AuthenticationDetailsProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("authenticationType".equals(fieldName)) {
deserializedAuthenticationDetailsProperties.authenticationType
= AuthenticationType.fromString(reader.getString());
} else if ("authenticationProvisioningState".equals(fieldName)) {
deserializedAuthenticationDetailsProperties.authenticationProvisioningState
= AuthenticationProvisioningState.fromString(reader.getString());
} else if ("grantedPermissions".equals(fieldName)) {
List grantedPermissions
= reader.readArray(reader1 -> PermissionProperty.fromString(reader1.getString()));
deserializedAuthenticationDetailsProperties.grantedPermissions = grantedPermissions;
} else {
reader.skipChildren();
}
}
return deserializedAuthenticationDetailsProperties;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy