com.azure.resourcemanager.automation.models.SourceControlSecurityTokenProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-automation Show documentation
Show all versions of azure-resourcemanager-automation Show documentation
This package contains Microsoft Azure SDK for Automation Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Automation Client. Package tag package-2022-02-22.
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.automation.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;
/**
* The SourceControlSecurityTokenProperties model.
*/
@Fluent
public final class SourceControlSecurityTokenProperties
implements JsonSerializable {
/*
* The access token.
*/
private String accessToken;
/*
* The refresh token.
*/
private String refreshToken;
/*
* The token type. Must be either PersonalAccessToken or Oauth.
*/
private TokenType tokenType;
/**
* Creates an instance of SourceControlSecurityTokenProperties class.
*/
public SourceControlSecurityTokenProperties() {
}
/**
* Get the accessToken property: The access token.
*
* @return the accessToken value.
*/
public String accessToken() {
return this.accessToken;
}
/**
* Set the accessToken property: The access token.
*
* @param accessToken the accessToken value to set.
* @return the SourceControlSecurityTokenProperties object itself.
*/
public SourceControlSecurityTokenProperties withAccessToken(String accessToken) {
this.accessToken = accessToken;
return this;
}
/**
* Get the refreshToken property: The refresh token.
*
* @return the refreshToken value.
*/
public String refreshToken() {
return this.refreshToken;
}
/**
* Set the refreshToken property: The refresh token.
*
* @param refreshToken the refreshToken value to set.
* @return the SourceControlSecurityTokenProperties object itself.
*/
public SourceControlSecurityTokenProperties withRefreshToken(String refreshToken) {
this.refreshToken = refreshToken;
return this;
}
/**
* Get the tokenType property: The token type. Must be either PersonalAccessToken or Oauth.
*
* @return the tokenType value.
*/
public TokenType tokenType() {
return this.tokenType;
}
/**
* Set the tokenType property: The token type. Must be either PersonalAccessToken or Oauth.
*
* @param tokenType the tokenType value to set.
* @return the SourceControlSecurityTokenProperties object itself.
*/
public SourceControlSecurityTokenProperties withTokenType(TokenType tokenType) {
this.tokenType = tokenType;
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("accessToken", this.accessToken);
jsonWriter.writeStringField("refreshToken", this.refreshToken);
jsonWriter.writeStringField("tokenType", this.tokenType == null ? null : this.tokenType.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of SourceControlSecurityTokenProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of SourceControlSecurityTokenProperties 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 SourceControlSecurityTokenProperties.
*/
public static SourceControlSecurityTokenProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
SourceControlSecurityTokenProperties deserializedSourceControlSecurityTokenProperties
= new SourceControlSecurityTokenProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("accessToken".equals(fieldName)) {
deserializedSourceControlSecurityTokenProperties.accessToken = reader.getString();
} else if ("refreshToken".equals(fieldName)) {
deserializedSourceControlSecurityTokenProperties.refreshToken = reader.getString();
} else if ("tokenType".equals(fieldName)) {
deserializedSourceControlSecurityTokenProperties.tokenType
= TokenType.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedSourceControlSecurityTokenProperties;
});
}
}