com.azure.resourcemanager.automation.models.PythonPackageCreateParameters Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-automation Show documentation
Show all versions of azure-resourcemanager-automation Show documentation
This package contains Microsoft Azure SDK for Automation Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Automation Client. Package tag package-2022-02-22.
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.automation.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 com.azure.resourcemanager.automation.fluent.models.PythonPackageCreateProperties;
import java.io.IOException;
import java.util.Map;
/**
* The parameters supplied to the create or update module operation.
*/
@Fluent
public final class PythonPackageCreateParameters implements JsonSerializable {
/*
* Gets or sets the module create properties.
*/
private PythonPackageCreateProperties innerProperties = new PythonPackageCreateProperties();
/*
* Gets or sets the tags attached to the resource.
*/
private Map tags;
/**
* Creates an instance of PythonPackageCreateParameters class.
*/
public PythonPackageCreateParameters() {
}
/**
* Get the innerProperties property: Gets or sets the module create properties.
*
* @return the innerProperties value.
*/
private PythonPackageCreateProperties innerProperties() {
return this.innerProperties;
}
/**
* Get the tags property: Gets or sets the tags attached to the resource.
*
* @return the tags value.
*/
public Map tags() {
return this.tags;
}
/**
* Set the tags property: Gets or sets the tags attached to the resource.
*
* @param tags the tags value to set.
* @return the PythonPackageCreateParameters object itself.
*/
public PythonPackageCreateParameters withTags(Map tags) {
this.tags = tags;
return this;
}
/**
* Get the contentLink property: Gets or sets the module content link.
*
* @return the contentLink value.
*/
public ContentLink contentLink() {
return this.innerProperties() == null ? null : this.innerProperties().contentLink();
}
/**
* Set the contentLink property: Gets or sets the module content link.
*
* @param contentLink the contentLink value to set.
* @return the PythonPackageCreateParameters object itself.
*/
public PythonPackageCreateParameters withContentLink(ContentLink contentLink) {
if (this.innerProperties() == null) {
this.innerProperties = new PythonPackageCreateProperties();
}
this.innerProperties().withContentLink(contentLink);
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 PythonPackageCreateParameters"));
} else {
innerProperties().validate();
}
}
private static final ClientLogger LOGGER = new ClientLogger(PythonPackageCreateParameters.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("properties", this.innerProperties);
jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of PythonPackageCreateParameters from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of PythonPackageCreateParameters 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 PythonPackageCreateParameters.
*/
public static PythonPackageCreateParameters fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
PythonPackageCreateParameters deserializedPythonPackageCreateParameters
= new PythonPackageCreateParameters();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("properties".equals(fieldName)) {
deserializedPythonPackageCreateParameters.innerProperties
= PythonPackageCreateProperties.fromJson(reader);
} else if ("tags".equals(fieldName)) {
Map tags = reader.readMap(reader1 -> reader1.getString());
deserializedPythonPackageCreateParameters.tags = tags;
} else {
reader.skipChildren();
}
}
return deserializedPythonPackageCreateParameters;
});
}
}