All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.securityinsights.fluent.models.RepoInner Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for SecurityInsights Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider. Package tag package-preview-2022-09.

The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.securityinsights.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.List;

/**
 * Represents a repository.
 */
@Fluent
public final class RepoInner implements JsonSerializable {
    /*
     * The url to access the repository.
     */
    private String url;

    /*
     * The name of the repository.
     */
    private String fullName;

    /*
     * Array of branches.
     */
    private List branches;

    /**
     * Creates an instance of RepoInner class.
     */
    public RepoInner() {
    }

    /**
     * Get the url property: The url to access the repository.
     * 
     * @return the url value.
     */
    public String url() {
        return this.url;
    }

    /**
     * Set the url property: The url to access the repository.
     * 
     * @param url the url value to set.
     * @return the RepoInner object itself.
     */
    public RepoInner withUrl(String url) {
        this.url = url;
        return this;
    }

    /**
     * Get the fullName property: The name of the repository.
     * 
     * @return the fullName value.
     */
    public String fullName() {
        return this.fullName;
    }

    /**
     * Set the fullName property: The name of the repository.
     * 
     * @param fullName the fullName value to set.
     * @return the RepoInner object itself.
     */
    public RepoInner withFullName(String fullName) {
        this.fullName = fullName;
        return this;
    }

    /**
     * Get the branches property: Array of branches.
     * 
     * @return the branches value.
     */
    public List branches() {
        return this.branches;
    }

    /**
     * Set the branches property: Array of branches.
     * 
     * @param branches the branches value to set.
     * @return the RepoInner object itself.
     */
    public RepoInner withBranches(List branches) {
        this.branches = branches;
        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("url", this.url);
        jsonWriter.writeStringField("fullName", this.fullName);
        jsonWriter.writeArrayField("branches", this.branches, (writer, element) -> writer.writeString(element));
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of RepoInner from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of RepoInner 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 RepoInner.
     */
    public static RepoInner fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            RepoInner deserializedRepoInner = new RepoInner();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("url".equals(fieldName)) {
                    deserializedRepoInner.url = reader.getString();
                } else if ("fullName".equals(fieldName)) {
                    deserializedRepoInner.fullName = reader.getString();
                } else if ("branches".equals(fieldName)) {
                    List branches = reader.readArray(reader1 -> reader1.getString());
                    deserializedRepoInner.branches = branches;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedRepoInner;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy