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

com.azure.resourcemanager.devcenter.models.GitCatalog 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.devcenter.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;

/**
 * Properties for a Git repository catalog.
 */
@Fluent
public final class GitCatalog implements JsonSerializable {
    /*
     * Git URI.
     */
    private String uri;

    /*
     * Git branch.
     */
    private String branch;

    /*
     * A reference to the Key Vault secret containing a security token to authenticate to a Git repository.
     */
    private String secretIdentifier;

    /*
     * The folder where the catalog items can be found inside the repository.
     */
    private String path;

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

    /**
     * Get the uri property: Git URI.
     * 
     * @return the uri value.
     */
    public String uri() {
        return this.uri;
    }

    /**
     * Set the uri property: Git URI.
     * 
     * @param uri the uri value to set.
     * @return the GitCatalog object itself.
     */
    public GitCatalog withUri(String uri) {
        this.uri = uri;
        return this;
    }

    /**
     * Get the branch property: Git branch.
     * 
     * @return the branch value.
     */
    public String branch() {
        return this.branch;
    }

    /**
     * Set the branch property: Git branch.
     * 
     * @param branch the branch value to set.
     * @return the GitCatalog object itself.
     */
    public GitCatalog withBranch(String branch) {
        this.branch = branch;
        return this;
    }

    /**
     * Get the secretIdentifier property: A reference to the Key Vault secret containing a security token to
     * authenticate to a Git repository.
     * 
     * @return the secretIdentifier value.
     */
    public String secretIdentifier() {
        return this.secretIdentifier;
    }

    /**
     * Set the secretIdentifier property: A reference to the Key Vault secret containing a security token to
     * authenticate to a Git repository.
     * 
     * @param secretIdentifier the secretIdentifier value to set.
     * @return the GitCatalog object itself.
     */
    public GitCatalog withSecretIdentifier(String secretIdentifier) {
        this.secretIdentifier = secretIdentifier;
        return this;
    }

    /**
     * Get the path property: The folder where the catalog items can be found inside the repository.
     * 
     * @return the path value.
     */
    public String path() {
        return this.path;
    }

    /**
     * Set the path property: The folder where the catalog items can be found inside the repository.
     * 
     * @param path the path value to set.
     * @return the GitCatalog object itself.
     */
    public GitCatalog withPath(String path) {
        this.path = path;
        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("uri", this.uri);
        jsonWriter.writeStringField("branch", this.branch);
        jsonWriter.writeStringField("secretIdentifier", this.secretIdentifier);
        jsonWriter.writeStringField("path", this.path);
        return jsonWriter.writeEndObject();
    }

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

                if ("uri".equals(fieldName)) {
                    deserializedGitCatalog.uri = reader.getString();
                } else if ("branch".equals(fieldName)) {
                    deserializedGitCatalog.branch = reader.getString();
                } else if ("secretIdentifier".equals(fieldName)) {
                    deserializedGitCatalog.secretIdentifier = reader.getString();
                } else if ("path".equals(fieldName)) {
                    deserializedGitCatalog.path = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedGitCatalog;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy