
com.azure.resourcemanager.datafactory.models.SsisPackage 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.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.List;
/**
* Ssis Package.
*/
@Fluent
public final class SsisPackage extends SsisObjectMetadata {
/*
* Type of metadata.
*/
private SsisObjectMetadataType type = SsisObjectMetadataType.PACKAGE;
/*
* Folder id which contains package.
*/
private Long folderId;
/*
* Project version which contains package.
*/
private Long projectVersion;
/*
* Project id which contains package.
*/
private Long projectId;
/*
* Parameters in package
*/
private List parameters;
/**
* Creates an instance of SsisPackage class.
*/
public SsisPackage() {
}
/**
* Get the type property: Type of metadata.
*
* @return the type value.
*/
@Override
public SsisObjectMetadataType type() {
return this.type;
}
/**
* Get the folderId property: Folder id which contains package.
*
* @return the folderId value.
*/
public Long folderId() {
return this.folderId;
}
/**
* Set the folderId property: Folder id which contains package.
*
* @param folderId the folderId value to set.
* @return the SsisPackage object itself.
*/
public SsisPackage withFolderId(Long folderId) {
this.folderId = folderId;
return this;
}
/**
* Get the projectVersion property: Project version which contains package.
*
* @return the projectVersion value.
*/
public Long projectVersion() {
return this.projectVersion;
}
/**
* Set the projectVersion property: Project version which contains package.
*
* @param projectVersion the projectVersion value to set.
* @return the SsisPackage object itself.
*/
public SsisPackage withProjectVersion(Long projectVersion) {
this.projectVersion = projectVersion;
return this;
}
/**
* Get the projectId property: Project id which contains package.
*
* @return the projectId value.
*/
public Long projectId() {
return this.projectId;
}
/**
* Set the projectId property: Project id which contains package.
*
* @param projectId the projectId value to set.
* @return the SsisPackage object itself.
*/
public SsisPackage withProjectId(Long projectId) {
this.projectId = projectId;
return this;
}
/**
* Get the parameters property: Parameters in package.
*
* @return the parameters value.
*/
public List parameters() {
return this.parameters;
}
/**
* Set the parameters property: Parameters in package.
*
* @param parameters the parameters value to set.
* @return the SsisPackage object itself.
*/
public SsisPackage withParameters(List parameters) {
this.parameters = parameters;
return this;
}
/**
* {@inheritDoc}
*/
@Override
public SsisPackage withId(Long id) {
super.withId(id);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public SsisPackage withName(String name) {
super.withName(name);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public SsisPackage withDescription(String description) {
super.withDescription(description);
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
public void validate() {
if (parameters() != null) {
parameters().forEach(e -> e.validate());
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeNumberField("id", id());
jsonWriter.writeStringField("name", name());
jsonWriter.writeStringField("description", description());
jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString());
jsonWriter.writeNumberField("folderId", this.folderId);
jsonWriter.writeNumberField("projectVersion", this.projectVersion);
jsonWriter.writeNumberField("projectId", this.projectId);
jsonWriter.writeArrayField("parameters", this.parameters, (writer, element) -> writer.writeJson(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of SsisPackage from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of SsisPackage if the JsonReader was pointing to an instance of it, or null if it was
* pointing to JSON null.
* @throws IOException If an error occurs while reading the SsisPackage.
*/
public static SsisPackage fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
SsisPackage deserializedSsisPackage = new SsisPackage();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("id".equals(fieldName)) {
deserializedSsisPackage.withId(reader.getNullable(JsonReader::getLong));
} else if ("name".equals(fieldName)) {
deserializedSsisPackage.withName(reader.getString());
} else if ("description".equals(fieldName)) {
deserializedSsisPackage.withDescription(reader.getString());
} else if ("type".equals(fieldName)) {
deserializedSsisPackage.type = SsisObjectMetadataType.fromString(reader.getString());
} else if ("folderId".equals(fieldName)) {
deserializedSsisPackage.folderId = reader.getNullable(JsonReader::getLong);
} else if ("projectVersion".equals(fieldName)) {
deserializedSsisPackage.projectVersion = reader.getNullable(JsonReader::getLong);
} else if ("projectId".equals(fieldName)) {
deserializedSsisPackage.projectId = reader.getNullable(JsonReader::getLong);
} else if ("parameters".equals(fieldName)) {
List parameters = reader.readArray(reader1 -> SsisParameter.fromJson(reader1));
deserializedSsisPackage.parameters = parameters;
} else {
reader.skipChildren();
}
}
return deserializedSsisPackage;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy