
com.azure.resourcemanager.datafactory.models.GitHubAccessTokenRequest 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.datafactory.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* Get GitHub access token request definition.
*/
@Fluent
public final class GitHubAccessTokenRequest implements JsonSerializable {
/*
* GitHub access code.
*/
private String gitHubAccessCode;
/*
* GitHub application client ID.
*/
private String gitHubClientId;
/*
* GitHub bring your own app client secret information.
*/
private GitHubClientSecret gitHubClientSecret;
/*
* GitHub access token base URL.
*/
private String gitHubAccessTokenBaseUrl;
/**
* Creates an instance of GitHubAccessTokenRequest class.
*/
public GitHubAccessTokenRequest() {
}
/**
* Get the gitHubAccessCode property: GitHub access code.
*
* @return the gitHubAccessCode value.
*/
public String gitHubAccessCode() {
return this.gitHubAccessCode;
}
/**
* Set the gitHubAccessCode property: GitHub access code.
*
* @param gitHubAccessCode the gitHubAccessCode value to set.
* @return the GitHubAccessTokenRequest object itself.
*/
public GitHubAccessTokenRequest withGitHubAccessCode(String gitHubAccessCode) {
this.gitHubAccessCode = gitHubAccessCode;
return this;
}
/**
* Get the gitHubClientId property: GitHub application client ID.
*
* @return the gitHubClientId value.
*/
public String gitHubClientId() {
return this.gitHubClientId;
}
/**
* Set the gitHubClientId property: GitHub application client ID.
*
* @param gitHubClientId the gitHubClientId value to set.
* @return the GitHubAccessTokenRequest object itself.
*/
public GitHubAccessTokenRequest withGitHubClientId(String gitHubClientId) {
this.gitHubClientId = gitHubClientId;
return this;
}
/**
* Get the gitHubClientSecret property: GitHub bring your own app client secret information.
*
* @return the gitHubClientSecret value.
*/
public GitHubClientSecret gitHubClientSecret() {
return this.gitHubClientSecret;
}
/**
* Set the gitHubClientSecret property: GitHub bring your own app client secret information.
*
* @param gitHubClientSecret the gitHubClientSecret value to set.
* @return the GitHubAccessTokenRequest object itself.
*/
public GitHubAccessTokenRequest withGitHubClientSecret(GitHubClientSecret gitHubClientSecret) {
this.gitHubClientSecret = gitHubClientSecret;
return this;
}
/**
* Get the gitHubAccessTokenBaseUrl property: GitHub access token base URL.
*
* @return the gitHubAccessTokenBaseUrl value.
*/
public String gitHubAccessTokenBaseUrl() {
return this.gitHubAccessTokenBaseUrl;
}
/**
* Set the gitHubAccessTokenBaseUrl property: GitHub access token base URL.
*
* @param gitHubAccessTokenBaseUrl the gitHubAccessTokenBaseUrl value to set.
* @return the GitHubAccessTokenRequest object itself.
*/
public GitHubAccessTokenRequest withGitHubAccessTokenBaseUrl(String gitHubAccessTokenBaseUrl) {
this.gitHubAccessTokenBaseUrl = gitHubAccessTokenBaseUrl;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (gitHubAccessCode() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property gitHubAccessCode in model GitHubAccessTokenRequest"));
}
if (gitHubClientSecret() != null) {
gitHubClientSecret().validate();
}
if (gitHubAccessTokenBaseUrl() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property gitHubAccessTokenBaseUrl in model GitHubAccessTokenRequest"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(GitHubAccessTokenRequest.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("gitHubAccessCode", this.gitHubAccessCode);
jsonWriter.writeStringField("gitHubAccessTokenBaseUrl", this.gitHubAccessTokenBaseUrl);
jsonWriter.writeStringField("gitHubClientId", this.gitHubClientId);
jsonWriter.writeJsonField("gitHubClientSecret", this.gitHubClientSecret);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of GitHubAccessTokenRequest from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of GitHubAccessTokenRequest if the JsonReader was pointing to an instance of it, or null if
* it was pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the GitHubAccessTokenRequest.
*/
public static GitHubAccessTokenRequest fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
GitHubAccessTokenRequest deserializedGitHubAccessTokenRequest = new GitHubAccessTokenRequest();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("gitHubAccessCode".equals(fieldName)) {
deserializedGitHubAccessTokenRequest.gitHubAccessCode = reader.getString();
} else if ("gitHubAccessTokenBaseUrl".equals(fieldName)) {
deserializedGitHubAccessTokenRequest.gitHubAccessTokenBaseUrl = reader.getString();
} else if ("gitHubClientId".equals(fieldName)) {
deserializedGitHubAccessTokenRequest.gitHubClientId = reader.getString();
} else if ("gitHubClientSecret".equals(fieldName)) {
deserializedGitHubAccessTokenRequest.gitHubClientSecret = GitHubClientSecret.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedGitHubAccessTokenRequest;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy