Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add RPO metadata settings (#1105)
* (feat) Add RPO metadata settings * Add javadoc * Apply suggestions from code review Co-authored-by: BenWhitehead <BenWhitehead@users.noreply.github.com> * typo * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fix clirr Co-authored-by: BenWhitehead <BenWhitehead@users.noreply.github.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
ece0fe5
commit 6f9dfdf
Showing
5 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
google-cloud-storage/src/main/java/com/google/cloud/storage/Rpo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Copyright 2021 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.google.cloud.storage; | ||
|
||
import com.google.api.core.ApiFunction; | ||
import com.google.cloud.StringEnumType; | ||
import com.google.cloud.StringEnumValue; | ||
|
||
/** | ||
* Enums for the Recovery Point Objective (RPO) of dual-region buckets, which determines how fast | ||
* data is replicated between regions. | ||
* | ||
* @see <a | ||
* href="https://cloud.google.com/storage/docs/turbo-replication">https://cloud.google.com/storage/docs/turbo-replication</a> | ||
*/ | ||
public final class Rpo extends StringEnumValue { | ||
|
||
private static final long serialVersionUID = -3954216195295821508L; | ||
|
||
private Rpo(String constant) { | ||
super(constant); | ||
} | ||
|
||
private static final ApiFunction<String, Rpo> CONSTRUCTOR = Rpo::new; | ||
|
||
private static final StringEnumType<Rpo> type = new StringEnumType<>(Rpo.class, CONSTRUCTOR); | ||
|
||
/** | ||
* Default recovery point objective. With this setting, there is no guarantee on the amount of | ||
* time it takes for data to replicate between regions. | ||
*/ | ||
public static final Rpo DEFAULT = type.createAndRegister("DEFAULT"); | ||
|
||
/** | ||
* Turbo recovery point objective. With this setting, data in a dual-region bucket will replicate | ||
* between regions within 15 minutes. | ||
*/ | ||
public static final Rpo ASYNC_TURBO = type.createAndRegister("ASYNC_TURBO"); | ||
|
||
/** | ||
* Get the Rpo for the given String constant, and throw an exception if the constant is not | ||
* recognized. | ||
*/ | ||
public static Rpo valueOfStrict(String constant) { | ||
return type.valueOfStrict(constant); | ||
} | ||
|
||
/** Get the Rpo for the given String constant, and allow unrecognized values. */ | ||
public static Rpo valueOf(String constant) { | ||
return type.valueOf(constant); | ||
} | ||
|
||
/** Return the known values for Rpo. */ | ||
public static Rpo[] values() { | ||
return type.values(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters