com.azure.resourcemanager.servicelinker.models.DryrunOperationPreview 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.servicelinker.models;
import com.azure.core.annotation.Fluent;
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 preview of the operations for creation.
*/
@Fluent
public final class DryrunOperationPreview implements JsonSerializable {
/*
* The operation name
*/
private String name;
/*
* The operation type
*/
private DryrunPreviewOperationType operationType;
/*
* The description of the operation
*/
private String description;
/*
* The action defined by RBAC, refer
* https://docs.microsoft.com/azure/role-based-access-control/role-definitions#actions-format
*/
private String action;
/*
* The scope of the operation, refer https://docs.microsoft.com/azure/role-based-access-control/scope-overview
*/
private String scope;
/**
* Creates an instance of DryrunOperationPreview class.
*/
public DryrunOperationPreview() {
}
/**
* Get the name property: The operation name.
*
* @return the name value.
*/
public String name() {
return this.name;
}
/**
* Set the name property: The operation name.
*
* @param name the name value to set.
* @return the DryrunOperationPreview object itself.
*/
public DryrunOperationPreview withName(String name) {
this.name = name;
return this;
}
/**
* Get the operationType property: The operation type.
*
* @return the operationType value.
*/
public DryrunPreviewOperationType operationType() {
return this.operationType;
}
/**
* Set the operationType property: The operation type.
*
* @param operationType the operationType value to set.
* @return the DryrunOperationPreview object itself.
*/
public DryrunOperationPreview withOperationType(DryrunPreviewOperationType operationType) {
this.operationType = operationType;
return this;
}
/**
* Get the description property: The description of the operation.
*
* @return the description value.
*/
public String description() {
return this.description;
}
/**
* Set the description property: The description of the operation.
*
* @param description the description value to set.
* @return the DryrunOperationPreview object itself.
*/
public DryrunOperationPreview withDescription(String description) {
this.description = description;
return this;
}
/**
* Get the action property: The action defined by RBAC, refer
* https://docs.microsoft.com/azure/role-based-access-control/role-definitions#actions-format.
*
* @return the action value.
*/
public String action() {
return this.action;
}
/**
* Set the action property: The action defined by RBAC, refer
* https://docs.microsoft.com/azure/role-based-access-control/role-definitions#actions-format.
*
* @param action the action value to set.
* @return the DryrunOperationPreview object itself.
*/
public DryrunOperationPreview withAction(String action) {
this.action = action;
return this;
}
/**
* Get the scope property: The scope of the operation, refer
* https://docs.microsoft.com/azure/role-based-access-control/scope-overview.
*
* @return the scope value.
*/
public String scope() {
return this.scope;
}
/**
* Set the scope property: The scope of the operation, refer
* https://docs.microsoft.com/azure/role-based-access-control/scope-overview.
*
* @param scope the scope value to set.
* @return the DryrunOperationPreview object itself.
*/
public DryrunOperationPreview withScope(String scope) {
this.scope = scope;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("name", this.name);
jsonWriter.writeStringField("operationType", this.operationType == null ? null : this.operationType.toString());
jsonWriter.writeStringField("description", this.description);
jsonWriter.writeStringField("action", this.action);
jsonWriter.writeStringField("scope", this.scope);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of DryrunOperationPreview from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of DryrunOperationPreview 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 DryrunOperationPreview.
*/
public static DryrunOperationPreview fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
DryrunOperationPreview deserializedDryrunOperationPreview = new DryrunOperationPreview();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("name".equals(fieldName)) {
deserializedDryrunOperationPreview.name = reader.getString();
} else if ("operationType".equals(fieldName)) {
deserializedDryrunOperationPreview.operationType
= DryrunPreviewOperationType.fromString(reader.getString());
} else if ("description".equals(fieldName)) {
deserializedDryrunOperationPreview.description = reader.getString();
} else if ("action".equals(fieldName)) {
deserializedDryrunOperationPreview.action = reader.getString();
} else if ("scope".equals(fieldName)) {
deserializedDryrunOperationPreview.scope = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedDryrunOperationPreview;
});
}
}