com.azure.resourcemanager.security.models.DevOpsPolicyDescriptor 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.security.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;
/**
* Condensed information to identify a DevOps Policy resource.
*/
@Fluent
public final class DevOpsPolicyDescriptor implements JsonSerializable {
/*
* Gets or sets the policy name.
*/
private String policyName;
/*
* Gets or sets the policy GUID.
*/
private String policyId;
/*
* Gets or sets the version.
*/
private String policyVersion;
/*
* DevOps Policy resource types.
*/
private DevOpsPolicyType policyType;
/**
* Creates an instance of DevOpsPolicyDescriptor class.
*/
public DevOpsPolicyDescriptor() {
}
/**
* Get the policyName property: Gets or sets the policy name.
*
* @return the policyName value.
*/
public String policyName() {
return this.policyName;
}
/**
* Set the policyName property: Gets or sets the policy name.
*
* @param policyName the policyName value to set.
* @return the DevOpsPolicyDescriptor object itself.
*/
public DevOpsPolicyDescriptor withPolicyName(String policyName) {
this.policyName = policyName;
return this;
}
/**
* Get the policyId property: Gets or sets the policy GUID.
*
* @return the policyId value.
*/
public String policyId() {
return this.policyId;
}
/**
* Set the policyId property: Gets or sets the policy GUID.
*
* @param policyId the policyId value to set.
* @return the DevOpsPolicyDescriptor object itself.
*/
public DevOpsPolicyDescriptor withPolicyId(String policyId) {
this.policyId = policyId;
return this;
}
/**
* Get the policyVersion property: Gets or sets the version.
*
* @return the policyVersion value.
*/
public String policyVersion() {
return this.policyVersion;
}
/**
* Set the policyVersion property: Gets or sets the version.
*
* @param policyVersion the policyVersion value to set.
* @return the DevOpsPolicyDescriptor object itself.
*/
public DevOpsPolicyDescriptor withPolicyVersion(String policyVersion) {
this.policyVersion = policyVersion;
return this;
}
/**
* Get the policyType property: DevOps Policy resource types.
*
* @return the policyType value.
*/
public DevOpsPolicyType policyType() {
return this.policyType;
}
/**
* Set the policyType property: DevOps Policy resource types.
*
* @param policyType the policyType value to set.
* @return the DevOpsPolicyDescriptor object itself.
*/
public DevOpsPolicyDescriptor withPolicyType(DevOpsPolicyType policyType) {
this.policyType = policyType;
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("policyName", this.policyName);
jsonWriter.writeStringField("policyId", this.policyId);
jsonWriter.writeStringField("policyVersion", this.policyVersion);
jsonWriter.writeStringField("policyType", this.policyType == null ? null : this.policyType.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of DevOpsPolicyDescriptor from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of DevOpsPolicyDescriptor 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 DevOpsPolicyDescriptor.
*/
public static DevOpsPolicyDescriptor fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
DevOpsPolicyDescriptor deserializedDevOpsPolicyDescriptor = new DevOpsPolicyDescriptor();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("policyName".equals(fieldName)) {
deserializedDevOpsPolicyDescriptor.policyName = reader.getString();
} else if ("policyId".equals(fieldName)) {
deserializedDevOpsPolicyDescriptor.policyId = reader.getString();
} else if ("policyVersion".equals(fieldName)) {
deserializedDevOpsPolicyDescriptor.policyVersion = reader.getString();
} else if ("policyType".equals(fieldName)) {
deserializedDevOpsPolicyDescriptor.policyType = DevOpsPolicyType.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedDevOpsPolicyDescriptor;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy