com.azure.resourcemanager.authorization.fluent.models.MicrosoftGraphResourceReference 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.authorization.fluent.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;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* resourceReference.
*/
@Fluent
public final class MicrosoftGraphResourceReference implements JsonSerializable {
/*
* The item's unique identifier.
*/
private String id;
/*
* A string value that can be used to classify the item, such as 'microsoft.graph.driveItem'
*/
private String type;
/*
* A URL leading to the referenced item.
*/
private String webUrl;
/*
* resourceReference
*/
private Map additionalProperties;
/**
* Creates an instance of MicrosoftGraphResourceReference class.
*/
public MicrosoftGraphResourceReference() {
}
/**
* Get the id property: The item's unique identifier.
*
* @return the id value.
*/
public String id() {
return this.id;
}
/**
* Set the id property: The item's unique identifier.
*
* @param id the id value to set.
* @return the MicrosoftGraphResourceReference object itself.
*/
public MicrosoftGraphResourceReference withId(String id) {
this.id = id;
return this;
}
/**
* Get the type property: A string value that can be used to classify the item, such as 'microsoft.graph.driveItem'.
*
* @return the type value.
*/
public String type() {
return this.type;
}
/**
* Set the type property: A string value that can be used to classify the item, such as 'microsoft.graph.driveItem'.
*
* @param type the type value to set.
* @return the MicrosoftGraphResourceReference object itself.
*/
public MicrosoftGraphResourceReference withType(String type) {
this.type = type;
return this;
}
/**
* Get the webUrl property: A URL leading to the referenced item.
*
* @return the webUrl value.
*/
public String webUrl() {
return this.webUrl;
}
/**
* Set the webUrl property: A URL leading to the referenced item.
*
* @param webUrl the webUrl value to set.
* @return the MicrosoftGraphResourceReference object itself.
*/
public MicrosoftGraphResourceReference withWebUrl(String webUrl) {
this.webUrl = webUrl;
return this;
}
/**
* Get the additionalProperties property: resourceReference.
*
* @return the additionalProperties value.
*/
public Map additionalProperties() {
return this.additionalProperties;
}
/**
* Set the additionalProperties property: resourceReference.
*
* @param additionalProperties the additionalProperties value to set.
* @return the MicrosoftGraphResourceReference object itself.
*/
public MicrosoftGraphResourceReference withAdditionalProperties(Map additionalProperties) {
this.additionalProperties = additionalProperties;
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("id", this.id);
jsonWriter.writeStringField("type", this.type);
jsonWriter.writeStringField("webUrl", this.webUrl);
if (additionalProperties != null) {
for (Map.Entry additionalProperty : additionalProperties.entrySet()) {
jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue());
}
}
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of MicrosoftGraphResourceReference from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of MicrosoftGraphResourceReference 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 MicrosoftGraphResourceReference.
*/
public static MicrosoftGraphResourceReference fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
MicrosoftGraphResourceReference deserializedMicrosoftGraphResourceReference
= new MicrosoftGraphResourceReference();
Map additionalProperties = null;
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("id".equals(fieldName)) {
deserializedMicrosoftGraphResourceReference.id = reader.getString();
} else if ("type".equals(fieldName)) {
deserializedMicrosoftGraphResourceReference.type = reader.getString();
} else if ("webUrl".equals(fieldName)) {
deserializedMicrosoftGraphResourceReference.webUrl = reader.getString();
} else {
if (additionalProperties == null) {
additionalProperties = new LinkedHashMap<>();
}
additionalProperties.put(fieldName, reader.readUntyped());
}
}
deserializedMicrosoftGraphResourceReference.additionalProperties = additionalProperties;
return deserializedMicrosoftGraphResourceReference;
});
}
}