You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: branches/lesv-patch-1/google-cloud-core/src/main/java/com/google/cloud/Role.java
+11-4Lines changed: 11 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -82,15 +82,22 @@ public static Role owner() {
82
82
/**
83
83
* Returns a new role given its string value.
84
84
*
85
-
* @param value the string value for the role, for example, {@code "roles/viewer"},
86
-
* {@code "roles/editor"}, or {@code "roles/owner"}. If this value does not start with the
87
-
* role prefix {@code roles/}, the prefix is prepended.
85
+
* <p>If the value contains no slash character ({@code '/'}), the prefix {@code "roles/""} is
86
+
* prepended. This slightly simplifies usage for <a
87
+
* href="https://cloud.google.com/iam/docs/understanding-roles>"predefined roles</a>. For <a
88
+
* href="https://cloud.google.com/iam/docs/creating-custom-roles">custom roles</a>, call this
89
+
* method with the fully-qualified name, eg {@code "projects/XXX/roles/YYY"}.
90
+
*
91
+
* @param value the string value for the role
88
92
* @see <a href="https://cloud.google.com/iam/docs/viewing-grantable-roles">Viewing the Grantable
89
93
* Roles on Resources</a>
90
94
*/
91
95
publicstaticRoleof(Stringvalue) {
92
96
checkNotNull(value);
93
-
returnnewRole(value.startsWith(ROLE_PREFIX) ? value : ROLE_PREFIX + value);
0 commit comments