
com.azure.resourcemanager.datafactory.models.WebAnonymousAuthentication 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.datafactory.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* A WebLinkedService that uses anonymous authentication to communicate with an HTTP endpoint.
*/
@Fluent
public final class WebAnonymousAuthentication extends WebLinkedServiceTypeProperties {
/*
* Type of authentication used to connect to the web table source.
*/
private WebAuthenticationType authenticationType = WebAuthenticationType.ANONYMOUS;
/**
* Creates an instance of WebAnonymousAuthentication class.
*/
public WebAnonymousAuthentication() {
}
/**
* Get the authenticationType property: Type of authentication used to connect to the web table source.
*
* @return the authenticationType value.
*/
@Override
public WebAuthenticationType authenticationType() {
return this.authenticationType;
}
/**
* {@inheritDoc}
*/
@Override
public WebAnonymousAuthentication withUrl(Object url) {
super.withUrl(url);
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
public void validate() {
if (url() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property url in model WebAnonymousAuthentication"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(WebAnonymousAuthentication.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeUntypedField("url", url());
jsonWriter.writeStringField("authenticationType",
this.authenticationType == null ? null : this.authenticationType.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of WebAnonymousAuthentication from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of WebAnonymousAuthentication 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 WebAnonymousAuthentication.
*/
public static WebAnonymousAuthentication fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
WebAnonymousAuthentication deserializedWebAnonymousAuthentication = new WebAnonymousAuthentication();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("url".equals(fieldName)) {
deserializedWebAnonymousAuthentication.withUrl(reader.readUntyped());
} else if ("authenticationType".equals(fieldName)) {
deserializedWebAnonymousAuthentication.authenticationType
= WebAuthenticationType.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedWebAnonymousAuthentication;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy