com.azure.resourcemanager.security.models.TargetBranchConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-security Show documentation
Show all versions of azure-resourcemanager-security Show documentation
This package contains Microsoft Azure SDK for Security Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.Security (Azure Security Center) resource provider. Package tag package-composite-v3.
// 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;
import java.util.List;
/**
* Repository branch configuration for PR Annotations.
*/
@Fluent
public final class TargetBranchConfiguration implements JsonSerializable {
/*
* Gets or sets branches that should have annotations.
*/
private List branchNames;
/*
* Configuration of PR Annotations on default branch.
*
* Enabled - PR Annotations are enabled on the resource's default branch.
* Disabled - PR Annotations are disabled on the resource's default branch.
*/
private AnnotateDefaultBranchState annotateDefaultBranch;
/**
* Creates an instance of TargetBranchConfiguration class.
*/
public TargetBranchConfiguration() {
}
/**
* Get the branchNames property: Gets or sets branches that should have annotations.
*
* @return the branchNames value.
*/
public List branchNames() {
return this.branchNames;
}
/**
* Set the branchNames property: Gets or sets branches that should have annotations.
*
* @param branchNames the branchNames value to set.
* @return the TargetBranchConfiguration object itself.
*/
public TargetBranchConfiguration withBranchNames(List branchNames) {
this.branchNames = branchNames;
return this;
}
/**
* Get the annotateDefaultBranch property: Configuration of PR Annotations on default branch.
*
* Enabled - PR Annotations are enabled on the resource's default branch.
* Disabled - PR Annotations are disabled on the resource's default branch.
*
* @return the annotateDefaultBranch value.
*/
public AnnotateDefaultBranchState annotateDefaultBranch() {
return this.annotateDefaultBranch;
}
/**
* Set the annotateDefaultBranch property: Configuration of PR Annotations on default branch.
*
* Enabled - PR Annotations are enabled on the resource's default branch.
* Disabled - PR Annotations are disabled on the resource's default branch.
*
* @param annotateDefaultBranch the annotateDefaultBranch value to set.
* @return the TargetBranchConfiguration object itself.
*/
public TargetBranchConfiguration withAnnotateDefaultBranch(AnnotateDefaultBranchState annotateDefaultBranch) {
this.annotateDefaultBranch = annotateDefaultBranch;
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.writeArrayField("branchNames", this.branchNames, (writer, element) -> writer.writeString(element));
jsonWriter.writeStringField("annotateDefaultBranch",
this.annotateDefaultBranch == null ? null : this.annotateDefaultBranch.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of TargetBranchConfiguration from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of TargetBranchConfiguration 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 TargetBranchConfiguration.
*/
public static TargetBranchConfiguration fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
TargetBranchConfiguration deserializedTargetBranchConfiguration = new TargetBranchConfiguration();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("branchNames".equals(fieldName)) {
List branchNames = reader.readArray(reader1 -> reader1.getString());
deserializedTargetBranchConfiguration.branchNames = branchNames;
} else if ("annotateDefaultBranch".equals(fieldName)) {
deserializedTargetBranchConfiguration.annotateDefaultBranch
= AnnotateDefaultBranchState.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedTargetBranchConfiguration;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy