|
| 1 | +// Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | +// Licensed under the MIT License. |
| 3 | +// Code generated by Microsoft (R) TypeSpec Code Generator. |
| 4 | +package com.azure.ai.agents.models; |
| 5 | + |
| 6 | +import com.azure.core.annotation.Fluent; |
| 7 | +import com.azure.core.annotation.Generated; |
| 8 | +import com.azure.json.JsonReader; |
| 9 | +import com.azure.json.JsonSerializable; |
| 10 | +import com.azure.json.JsonToken; |
| 11 | +import com.azure.json.JsonWriter; |
| 12 | +import java.io.IOException; |
| 13 | +import java.util.Map; |
| 14 | + |
| 15 | +/** |
| 16 | + * The CreateAgentVersionInput model. |
| 17 | + */ |
| 18 | +@Fluent |
| 19 | +public final class CreateAgentVersionInput implements JsonSerializable<CreateAgentVersionInput> { |
| 20 | + |
| 21 | + /* |
| 22 | + * Set of 16 key-value pairs that can be attached to an object. This can be |
| 23 | + * useful for storing additional information about the object in a structured |
| 24 | + * format, and querying for objects via API or the dashboard. |
| 25 | + * |
| 26 | + * Keys are strings with a maximum length of 64 characters. Values are strings |
| 27 | + * with a maximum length of 512 characters. |
| 28 | + */ |
| 29 | + @Generated |
| 30 | + private Map<String, String> metadata; |
| 31 | + |
| 32 | + /* |
| 33 | + * A human-readable description of the agent. |
| 34 | + */ |
| 35 | + @Generated |
| 36 | + private String description; |
| 37 | + |
| 38 | + /* |
| 39 | + * The agent definition. This can be a workflow, hosted agent, or a simple agent definition. |
| 40 | + */ |
| 41 | + @Generated |
| 42 | + private final AgentDefinition definition; |
| 43 | + |
| 44 | + /* |
| 45 | + * The blueprint reference for the agent. |
| 46 | + */ |
| 47 | + @Generated |
| 48 | + private AgentBlueprintReference blueprintReference; |
| 49 | + |
| 50 | + /** |
| 51 | + * Creates an instance of CreateAgentVersionInput class. |
| 52 | + * |
| 53 | + * @param definition the definition value to set. |
| 54 | + */ |
| 55 | + @Generated |
| 56 | + public CreateAgentVersionInput(AgentDefinition definition) { |
| 57 | + this.definition = definition; |
| 58 | + } |
| 59 | + |
| 60 | + /** |
| 61 | + * Get the metadata property: Set of 16 key-value pairs that can be attached to an object. This can be |
| 62 | + * useful for storing additional information about the object in a structured |
| 63 | + * format, and querying for objects via API or the dashboard. |
| 64 | + * |
| 65 | + * Keys are strings with a maximum length of 64 characters. Values are strings |
| 66 | + * with a maximum length of 512 characters. |
| 67 | + * |
| 68 | + * @return the metadata value. |
| 69 | + */ |
| 70 | + @Generated |
| 71 | + public Map<String, String> getMetadata() { |
| 72 | + return this.metadata; |
| 73 | + } |
| 74 | + |
| 75 | + /** |
| 76 | + * Set the metadata property: Set of 16 key-value pairs that can be attached to an object. This can be |
| 77 | + * useful for storing additional information about the object in a structured |
| 78 | + * format, and querying for objects via API or the dashboard. |
| 79 | + * |
| 80 | + * Keys are strings with a maximum length of 64 characters. Values are strings |
| 81 | + * with a maximum length of 512 characters. |
| 82 | + * |
| 83 | + * @param metadata the metadata value to set. |
| 84 | + * @return the CreateAgentVersionInput object itself. |
| 85 | + */ |
| 86 | + @Generated |
| 87 | + public CreateAgentVersionInput setMetadata(Map<String, String> metadata) { |
| 88 | + this.metadata = metadata; |
| 89 | + return this; |
| 90 | + } |
| 91 | + |
| 92 | + /** |
| 93 | + * Get the description property: A human-readable description of the agent. |
| 94 | + * |
| 95 | + * @return the description value. |
| 96 | + */ |
| 97 | + @Generated |
| 98 | + public String getDescription() { |
| 99 | + return this.description; |
| 100 | + } |
| 101 | + |
| 102 | + /** |
| 103 | + * Set the description property: A human-readable description of the agent. |
| 104 | + * |
| 105 | + * @param description the description value to set. |
| 106 | + * @return the CreateAgentVersionInput object itself. |
| 107 | + */ |
| 108 | + @Generated |
| 109 | + public CreateAgentVersionInput setDescription(String description) { |
| 110 | + this.description = description; |
| 111 | + return this; |
| 112 | + } |
| 113 | + |
| 114 | + /** |
| 115 | + * Get the definition property: The agent definition. This can be a workflow, hosted agent, or a simple agent |
| 116 | + * definition. |
| 117 | + * |
| 118 | + * @return the definition value. |
| 119 | + */ |
| 120 | + @Generated |
| 121 | + public AgentDefinition getDefinition() { |
| 122 | + return this.definition; |
| 123 | + } |
| 124 | + |
| 125 | + /** |
| 126 | + * Get the blueprintReference property: The blueprint reference for the agent. |
| 127 | + * |
| 128 | + * @return the blueprintReference value. |
| 129 | + */ |
| 130 | + @Generated |
| 131 | + public AgentBlueprintReference getBlueprintReference() { |
| 132 | + return this.blueprintReference; |
| 133 | + } |
| 134 | + |
| 135 | + /** |
| 136 | + * Set the blueprintReference property: The blueprint reference for the agent. |
| 137 | + * |
| 138 | + * @param blueprintReference the blueprintReference value to set. |
| 139 | + * @return the CreateAgentVersionInput object itself. |
| 140 | + */ |
| 141 | + @Generated |
| 142 | + public CreateAgentVersionInput setBlueprintReference(AgentBlueprintReference blueprintReference) { |
| 143 | + this.blueprintReference = blueprintReference; |
| 144 | + return this; |
| 145 | + } |
| 146 | + |
| 147 | + /** |
| 148 | + * {@inheritDoc} |
| 149 | + */ |
| 150 | + @Generated |
| 151 | + @Override |
| 152 | + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { |
| 153 | + jsonWriter.writeStartObject(); |
| 154 | + jsonWriter.writeJsonField("definition", this.definition); |
| 155 | + jsonWriter.writeMapField("metadata", this.metadata, (writer, element) -> writer.writeString(element)); |
| 156 | + jsonWriter.writeStringField("description", this.description); |
| 157 | + jsonWriter.writeJsonField("blueprint_reference", this.blueprintReference); |
| 158 | + return jsonWriter.writeEndObject(); |
| 159 | + } |
| 160 | + |
| 161 | + /** |
| 162 | + * Reads an instance of CreateAgentVersionInput from the JsonReader. |
| 163 | + * |
| 164 | + * @param jsonReader The JsonReader being read. |
| 165 | + * @return An instance of CreateAgentVersionInput if the JsonReader was pointing to an instance of it, or null if it |
| 166 | + * was pointing to JSON null. |
| 167 | + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. |
| 168 | + * @throws IOException If an error occurs while reading the CreateAgentVersionInput. |
| 169 | + */ |
| 170 | + @Generated |
| 171 | + public static CreateAgentVersionInput fromJson(JsonReader jsonReader) throws IOException { |
| 172 | + return jsonReader.readObject(reader -> { |
| 173 | + AgentDefinition definition = null; |
| 174 | + Map<String, String> metadata = null; |
| 175 | + String description = null; |
| 176 | + AgentBlueprintReference blueprintReference = null; |
| 177 | + while (reader.nextToken() != JsonToken.END_OBJECT) { |
| 178 | + String fieldName = reader.getFieldName(); |
| 179 | + reader.nextToken(); |
| 180 | + if ("definition".equals(fieldName)) { |
| 181 | + definition = AgentDefinition.fromJson(reader); |
| 182 | + } else if ("metadata".equals(fieldName)) { |
| 183 | + metadata = reader.readMap(reader1 -> reader1.getString()); |
| 184 | + } else if ("description".equals(fieldName)) { |
| 185 | + description = reader.getString(); |
| 186 | + } else if ("blueprint_reference".equals(fieldName)) { |
| 187 | + blueprintReference = AgentBlueprintReference.fromJson(reader); |
| 188 | + } else { |
| 189 | + reader.skipChildren(); |
| 190 | + } |
| 191 | + } |
| 192 | + CreateAgentVersionInput deserializedCreateAgentVersionInput = new CreateAgentVersionInput(definition); |
| 193 | + deserializedCreateAgentVersionInput.metadata = metadata; |
| 194 | + deserializedCreateAgentVersionInput.description = description; |
| 195 | + deserializedCreateAgentVersionInput.blueprintReference = blueprintReference; |
| 196 | + return deserializedCreateAgentVersionInput; |
| 197 | + }); |
| 198 | + } |
| 199 | +} |
0 commit comments