com.azure.resourcemanager.machinelearning.models.ServerlessEndpointProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-machinelearning Show documentation
Show all versions of azure-resourcemanager-machinelearning Show documentation
This package contains Microsoft Azure SDK for Machine Learning Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. These APIs allow end users to operate on Azure Machine Learning Workspace resources. Package tag package-2024-04.
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.machinelearning.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* The ServerlessEndpointProperties model.
*/
@Fluent
public final class ServerlessEndpointProperties implements JsonSerializable {
/*
* The model settings (model id) for the model being serviced on the ServerlessEndpoint.
*/
private ModelSettings modelSettings;
/*
* [Required] Specifies the authentication mode for the Serverless endpoint.
*/
private ServerlessInferenceEndpointAuthMode authMode;
/*
* The inference uri to target when making requests against the serverless endpoint
*/
private ServerlessInferenceEndpoint inferenceEndpoint;
/*
* Provisioning state for the endpoint.
*/
private EndpointProvisioningState provisioningState;
/*
* The current state of the ServerlessEndpoint.
*/
private ServerlessEndpointState endpointState;
/*
* The MarketplaceSubscription Azure ID associated to this ServerlessEndpoint.
*/
private String marketplaceSubscriptionId;
/*
* Specifies the content safety options. If omitted, the default content safety settings will be configured
*/
private ContentSafety contentSafety;
/**
* Creates an instance of ServerlessEndpointProperties class.
*/
public ServerlessEndpointProperties() {
}
/**
* Get the modelSettings property: The model settings (model id) for the model being serviced on the
* ServerlessEndpoint.
*
* @return the modelSettings value.
*/
public ModelSettings modelSettings() {
return this.modelSettings;
}
/**
* Set the modelSettings property: The model settings (model id) for the model being serviced on the
* ServerlessEndpoint.
*
* @param modelSettings the modelSettings value to set.
* @return the ServerlessEndpointProperties object itself.
*/
public ServerlessEndpointProperties withModelSettings(ModelSettings modelSettings) {
this.modelSettings = modelSettings;
return this;
}
/**
* Get the authMode property: [Required] Specifies the authentication mode for the Serverless endpoint.
*
* @return the authMode value.
*/
public ServerlessInferenceEndpointAuthMode authMode() {
return this.authMode;
}
/**
* Set the authMode property: [Required] Specifies the authentication mode for the Serverless endpoint.
*
* @param authMode the authMode value to set.
* @return the ServerlessEndpointProperties object itself.
*/
public ServerlessEndpointProperties withAuthMode(ServerlessInferenceEndpointAuthMode authMode) {
this.authMode = authMode;
return this;
}
/**
* Get the inferenceEndpoint property: The inference uri to target when making requests against the serverless
* endpoint.
*
* @return the inferenceEndpoint value.
*/
public ServerlessInferenceEndpoint inferenceEndpoint() {
return this.inferenceEndpoint;
}
/**
* Get the provisioningState property: Provisioning state for the endpoint.
*
* @return the provisioningState value.
*/
public EndpointProvisioningState provisioningState() {
return this.provisioningState;
}
/**
* Get the endpointState property: The current state of the ServerlessEndpoint.
*
* @return the endpointState value.
*/
public ServerlessEndpointState endpointState() {
return this.endpointState;
}
/**
* Get the marketplaceSubscriptionId property: The MarketplaceSubscription Azure ID associated to this
* ServerlessEndpoint.
*
* @return the marketplaceSubscriptionId value.
*/
public String marketplaceSubscriptionId() {
return this.marketplaceSubscriptionId;
}
/**
* Get the contentSafety property: Specifies the content safety options. If omitted, the default content safety
* settings will be configured.
*
* @return the contentSafety value.
*/
public ContentSafety contentSafety() {
return this.contentSafety;
}
/**
* Set the contentSafety property: Specifies the content safety options. If omitted, the default content safety
* settings will be configured.
*
* @param contentSafety the contentSafety value to set.
* @return the ServerlessEndpointProperties object itself.
*/
public ServerlessEndpointProperties withContentSafety(ContentSafety contentSafety) {
this.contentSafety = contentSafety;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (modelSettings() != null) {
modelSettings().validate();
}
if (authMode() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property authMode in model ServerlessEndpointProperties"));
}
if (inferenceEndpoint() != null) {
inferenceEndpoint().validate();
}
if (contentSafety() != null) {
contentSafety().validate();
}
}
private static final ClientLogger LOGGER = new ClientLogger(ServerlessEndpointProperties.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("authMode", this.authMode == null ? null : this.authMode.toString());
jsonWriter.writeJsonField("modelSettings", this.modelSettings);
jsonWriter.writeJsonField("contentSafety", this.contentSafety);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ServerlessEndpointProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ServerlessEndpointProperties 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 ServerlessEndpointProperties.
*/
public static ServerlessEndpointProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ServerlessEndpointProperties deserializedServerlessEndpointProperties = new ServerlessEndpointProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("authMode".equals(fieldName)) {
deserializedServerlessEndpointProperties.authMode
= ServerlessInferenceEndpointAuthMode.fromString(reader.getString());
} else if ("modelSettings".equals(fieldName)) {
deserializedServerlessEndpointProperties.modelSettings = ModelSettings.fromJson(reader);
} else if ("inferenceEndpoint".equals(fieldName)) {
deserializedServerlessEndpointProperties.inferenceEndpoint
= ServerlessInferenceEndpoint.fromJson(reader);
} else if ("provisioningState".equals(fieldName)) {
deserializedServerlessEndpointProperties.provisioningState
= EndpointProvisioningState.fromString(reader.getString());
} else if ("endpointState".equals(fieldName)) {
deserializedServerlessEndpointProperties.endpointState
= ServerlessEndpointState.fromString(reader.getString());
} else if ("marketplaceSubscriptionId".equals(fieldName)) {
deserializedServerlessEndpointProperties.marketplaceSubscriptionId = reader.getString();
} else if ("contentSafety".equals(fieldName)) {
deserializedServerlessEndpointProperties.contentSafety = ContentSafety.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedServerlessEndpointProperties;
});
}
}