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

com.azure.resourcemanager.security.models.GitHubRepositoryProperties 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.core.util.CoreUtils;
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.time.OffsetDateTime;

/**
 * GitHub Repository properties.
 */
@Fluent
public final class GitHubRepositoryProperties implements JsonSerializable {
    /*
     * Gets the resource status message.
     */
    private String provisioningStatusMessage;

    /*
     * Gets the time when resource was last checked.
     */
    private OffsetDateTime provisioningStatusUpdateTimeUtc;

    /*
     * The provisioning state of the resource.
     * 
     * Pending - Provisioning pending.
     * Failed - Provisioning failed.
     * Succeeded - Successful provisioning.
     * Canceled - Provisioning canceled.
     * PendingDeletion - Deletion pending.
     * DeletionSuccess - Deletion successful.
     * DeletionFailure - Deletion failure.
     */
    private DevOpsProvisioningState provisioningState;

    /*
     * Gets or sets GitHub Repository id.
     * 
     * This is a numeric id defined by Github.
     * Eg: "123456".
     */
    private String repoId;

    /*
     * Gets or sets GitHub Repository name.
     * Eg: "new-repo-1".
     */
    private String repoName;

    /*
     * Gets or sets GitHub Full Name.
     * Repository name, prefixed with Owner name.
     * Eg: "my-org/new-repo-1".
     */
    private String repoFullName;

    /*
     * Details about resource onboarding status across all connectors.
     * 
     * OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only
     * applicable to top-level resources.
     * Onboarded - this resource has already been onboarded by the specified connector.
     * NotOnboarded - this resource has not been onboarded to any connector.
     * NotApplicable - the onboarding state is not applicable to the current endpoint.
     */
    private OnboardingState onboardingState;

    /*
     * Gets or sets GitHub Repository url.
     */
    private String repoUrl;

    /*
     * Gets or sets parent GitHub Owner name.
     */
    private String parentOwnerName;

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

    /**
     * Get the provisioningStatusMessage property: Gets the resource status message.
     * 
     * @return the provisioningStatusMessage value.
     */
    public String provisioningStatusMessage() {
        return this.provisioningStatusMessage;
    }

    /**
     * Get the provisioningStatusUpdateTimeUtc property: Gets the time when resource was last checked.
     * 
     * @return the provisioningStatusUpdateTimeUtc value.
     */
    public OffsetDateTime provisioningStatusUpdateTimeUtc() {
        return this.provisioningStatusUpdateTimeUtc;
    }

    /**
     * Get the provisioningState property: The provisioning state of the resource.
     * 
     * Pending - Provisioning pending.
     * Failed - Provisioning failed.
     * Succeeded - Successful provisioning.
     * Canceled - Provisioning canceled.
     * PendingDeletion - Deletion pending.
     * DeletionSuccess - Deletion successful.
     * DeletionFailure - Deletion failure.
     * 
     * @return the provisioningState value.
     */
    public DevOpsProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the repoId property: Gets or sets GitHub Repository id.
     * 
     * This is a numeric id defined by Github.
     * Eg: "123456".
     * 
     * @return the repoId value.
     */
    public String repoId() {
        return this.repoId;
    }

    /**
     * Get the repoName property: Gets or sets GitHub Repository name.
     * Eg: "new-repo-1".
     * 
     * @return the repoName value.
     */
    public String repoName() {
        return this.repoName;
    }

    /**
     * Get the repoFullName property: Gets or sets GitHub Full Name.
     * Repository name, prefixed with Owner name.
     * Eg: "my-org/new-repo-1".
     * 
     * @return the repoFullName value.
     */
    public String repoFullName() {
        return this.repoFullName;
    }

    /**
     * Get the onboardingState property: Details about resource onboarding status across all connectors.
     * 
     * OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only
     * applicable to top-level resources.
     * Onboarded - this resource has already been onboarded by the specified connector.
     * NotOnboarded - this resource has not been onboarded to any connector.
     * NotApplicable - the onboarding state is not applicable to the current endpoint.
     * 
     * @return the onboardingState value.
     */
    public OnboardingState onboardingState() {
        return this.onboardingState;
    }

    /**
     * Set the onboardingState property: Details about resource onboarding status across all connectors.
     * 
     * OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only
     * applicable to top-level resources.
     * Onboarded - this resource has already been onboarded by the specified connector.
     * NotOnboarded - this resource has not been onboarded to any connector.
     * NotApplicable - the onboarding state is not applicable to the current endpoint.
     * 
     * @param onboardingState the onboardingState value to set.
     * @return the GitHubRepositoryProperties object itself.
     */
    public GitHubRepositoryProperties withOnboardingState(OnboardingState onboardingState) {
        this.onboardingState = onboardingState;
        return this;
    }

    /**
     * Get the repoUrl property: Gets or sets GitHub Repository url.
     * 
     * @return the repoUrl value.
     */
    public String repoUrl() {
        return this.repoUrl;
    }

    /**
     * Get the parentOwnerName property: Gets or sets parent GitHub Owner name.
     * 
     * @return the parentOwnerName value.
     */
    public String parentOwnerName() {
        return this.parentOwnerName;
    }

    /**
     * Set the parentOwnerName property: Gets or sets parent GitHub Owner name.
     * 
     * @param parentOwnerName the parentOwnerName value to set.
     * @return the GitHubRepositoryProperties object itself.
     */
    public GitHubRepositoryProperties withParentOwnerName(String parentOwnerName) {
        this.parentOwnerName = parentOwnerName;
        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("onboardingState",
            this.onboardingState == null ? null : this.onboardingState.toString());
        jsonWriter.writeStringField("parentOwnerName", this.parentOwnerName);
        return jsonWriter.writeEndObject();
    }

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

                if ("provisioningStatusMessage".equals(fieldName)) {
                    deserializedGitHubRepositoryProperties.provisioningStatusMessage = reader.getString();
                } else if ("provisioningStatusUpdateTimeUtc".equals(fieldName)) {
                    deserializedGitHubRepositoryProperties.provisioningStatusUpdateTimeUtc = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("provisioningState".equals(fieldName)) {
                    deserializedGitHubRepositoryProperties.provisioningState
                        = DevOpsProvisioningState.fromString(reader.getString());
                } else if ("repoId".equals(fieldName)) {
                    deserializedGitHubRepositoryProperties.repoId = reader.getString();
                } else if ("repoName".equals(fieldName)) {
                    deserializedGitHubRepositoryProperties.repoName = reader.getString();
                } else if ("repoFullName".equals(fieldName)) {
                    deserializedGitHubRepositoryProperties.repoFullName = reader.getString();
                } else if ("onboardingState".equals(fieldName)) {
                    deserializedGitHubRepositoryProperties.onboardingState
                        = OnboardingState.fromString(reader.getString());
                } else if ("repoUrl".equals(fieldName)) {
                    deserializedGitHubRepositoryProperties.repoUrl = reader.getString();
                } else if ("parentOwnerName".equals(fieldName)) {
                    deserializedGitHubRepositoryProperties.parentOwnerName = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedGitHubRepositoryProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy