com.azure.resourcemanager.servicelinker.fluent.models.LinkerResourceInner 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.servicelinker.fluent.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.servicelinker.models.AuthInfoBase;
import com.azure.resourcemanager.servicelinker.models.ClientType;
import com.azure.resourcemanager.servicelinker.models.ConfigurationInfo;
import com.azure.resourcemanager.servicelinker.models.PublicNetworkSolution;
import com.azure.resourcemanager.servicelinker.models.SecretStore;
import com.azure.resourcemanager.servicelinker.models.TargetServiceBase;
import com.azure.resourcemanager.servicelinker.models.VNetSolution;
import java.io.IOException;
/**
* Linker of source and target resource.
*/
@Fluent
public final class LinkerResourceInner extends ProxyResource {
/*
* The properties of the Linker.
*/
private LinkerProperties innerProperties = new LinkerProperties();
/*
* Azure Resource Manager metadata containing createdBy and modifiedBy information.
*/
private SystemData systemData;
/*
* The type of the resource.
*/
private String type;
/*
* The name of the resource.
*/
private String name;
/*
* Fully qualified resource Id for the resource.
*/
private String id;
/**
* Creates an instance of LinkerResourceInner class.
*/
public LinkerResourceInner() {
}
/**
* Get the innerProperties property: The properties of the Linker.
*
* @return the innerProperties value.
*/
private LinkerProperties innerProperties() {
return this.innerProperties;
}
/**
* Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information.
*
* @return the systemData value.
*/
public SystemData systemData() {
return this.systemData;
}
/**
* Get the type property: The type of the resource.
*
* @return the type value.
*/
@Override
public String type() {
return this.type;
}
/**
* Get the name property: The name of the resource.
*
* @return the name value.
*/
@Override
public String name() {
return this.name;
}
/**
* Get the id property: Fully qualified resource Id for the resource.
*
* @return the id value.
*/
@Override
public String id() {
return this.id;
}
/**
* Get the targetService property: The target service properties.
*
* @return the targetService value.
*/
public TargetServiceBase targetService() {
return this.innerProperties() == null ? null : this.innerProperties().targetService();
}
/**
* Set the targetService property: The target service properties.
*
* @param targetService the targetService value to set.
* @return the LinkerResourceInner object itself.
*/
public LinkerResourceInner withTargetService(TargetServiceBase targetService) {
if (this.innerProperties() == null) {
this.innerProperties = new LinkerProperties();
}
this.innerProperties().withTargetService(targetService);
return this;
}
/**
* Get the authInfo property: The authentication type.
*
* @return the authInfo value.
*/
public AuthInfoBase authInfo() {
return this.innerProperties() == null ? null : this.innerProperties().authInfo();
}
/**
* Set the authInfo property: The authentication type.
*
* @param authInfo the authInfo value to set.
* @return the LinkerResourceInner object itself.
*/
public LinkerResourceInner withAuthInfo(AuthInfoBase authInfo) {
if (this.innerProperties() == null) {
this.innerProperties = new LinkerProperties();
}
this.innerProperties().withAuthInfo(authInfo);
return this;
}
/**
* Get the clientType property: The application client type.
*
* @return the clientType value.
*/
public ClientType clientType() {
return this.innerProperties() == null ? null : this.innerProperties().clientType();
}
/**
* Set the clientType property: The application client type.
*
* @param clientType the clientType value to set.
* @return the LinkerResourceInner object itself.
*/
public LinkerResourceInner withClientType(ClientType clientType) {
if (this.innerProperties() == null) {
this.innerProperties = new LinkerProperties();
}
this.innerProperties().withClientType(clientType);
return this;
}
/**
* Get the provisioningState property: The provisioning state.
*
* @return the provisioningState value.
*/
public String provisioningState() {
return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
}
/**
* Get the vNetSolution property: The VNet solution.
*
* @return the vNetSolution value.
*/
public VNetSolution vNetSolution() {
return this.innerProperties() == null ? null : this.innerProperties().vNetSolution();
}
/**
* Set the vNetSolution property: The VNet solution.
*
* @param vNetSolution the vNetSolution value to set.
* @return the LinkerResourceInner object itself.
*/
public LinkerResourceInner withVNetSolution(VNetSolution vNetSolution) {
if (this.innerProperties() == null) {
this.innerProperties = new LinkerProperties();
}
this.innerProperties().withVNetSolution(vNetSolution);
return this;
}
/**
* Get the secretStore property: An option to store secret value in secure place.
*
* @return the secretStore value.
*/
public SecretStore secretStore() {
return this.innerProperties() == null ? null : this.innerProperties().secretStore();
}
/**
* Set the secretStore property: An option to store secret value in secure place.
*
* @param secretStore the secretStore value to set.
* @return the LinkerResourceInner object itself.
*/
public LinkerResourceInner withSecretStore(SecretStore secretStore) {
if (this.innerProperties() == null) {
this.innerProperties = new LinkerProperties();
}
this.innerProperties().withSecretStore(secretStore);
return this;
}
/**
* Get the scope property: connection scope in source service.
*
* @return the scope value.
*/
public String scope() {
return this.innerProperties() == null ? null : this.innerProperties().scope();
}
/**
* Set the scope property: connection scope in source service.
*
* @param scope the scope value to set.
* @return the LinkerResourceInner object itself.
*/
public LinkerResourceInner withScope(String scope) {
if (this.innerProperties() == null) {
this.innerProperties = new LinkerProperties();
}
this.innerProperties().withScope(scope);
return this;
}
/**
* Get the publicNetworkSolution property: The network solution.
*
* @return the publicNetworkSolution value.
*/
public PublicNetworkSolution publicNetworkSolution() {
return this.innerProperties() == null ? null : this.innerProperties().publicNetworkSolution();
}
/**
* Set the publicNetworkSolution property: The network solution.
*
* @param publicNetworkSolution the publicNetworkSolution value to set.
* @return the LinkerResourceInner object itself.
*/
public LinkerResourceInner withPublicNetworkSolution(PublicNetworkSolution publicNetworkSolution) {
if (this.innerProperties() == null) {
this.innerProperties = new LinkerProperties();
}
this.innerProperties().withPublicNetworkSolution(publicNetworkSolution);
return this;
}
/**
* Get the configurationInfo property: The connection information consumed by applications, including secrets,
* connection strings.
*
* @return the configurationInfo value.
*/
public ConfigurationInfo configurationInfo() {
return this.innerProperties() == null ? null : this.innerProperties().configurationInfo();
}
/**
* Set the configurationInfo property: The connection information consumed by applications, including secrets,
* connection strings.
*
* @param configurationInfo the configurationInfo value to set.
* @return the LinkerResourceInner object itself.
*/
public LinkerResourceInner withConfigurationInfo(ConfigurationInfo configurationInfo) {
if (this.innerProperties() == null) {
this.innerProperties = new LinkerProperties();
}
this.innerProperties().withConfigurationInfo(configurationInfo);
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (innerProperties() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property innerProperties in model LinkerResourceInner"));
} else {
innerProperties().validate();
}
}
private static final ClientLogger LOGGER = new ClientLogger(LinkerResourceInner.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("properties", this.innerProperties);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of LinkerResourceInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of LinkerResourceInner if the JsonReader was pointing to an instance of it, or null if it was
* pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the LinkerResourceInner.
*/
public static LinkerResourceInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
LinkerResourceInner deserializedLinkerResourceInner = new LinkerResourceInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("id".equals(fieldName)) {
deserializedLinkerResourceInner.id = reader.getString();
} else if ("name".equals(fieldName)) {
deserializedLinkerResourceInner.name = reader.getString();
} else if ("type".equals(fieldName)) {
deserializedLinkerResourceInner.type = reader.getString();
} else if ("properties".equals(fieldName)) {
deserializedLinkerResourceInner.innerProperties = LinkerProperties.fromJson(reader);
} else if ("systemData".equals(fieldName)) {
deserializedLinkerResourceInner.systemData = SystemData.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedLinkerResourceInner;
});
}
}