Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [orgpolicy] Add custom constraints CRUD APIs, proper etag support in Org Policy Update/Delete API #10163

Merged
merged 2 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion java-orgpolicy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html
[stability-image]: https://img.shields.io/badge/stability-stable-green
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-orgpolicy.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-orgpolicy/2.30.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-orgpolicy/2.32.0
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.google.cloud.orgpolicy.v2;

import static com.google.cloud.orgpolicy.v2.OrgPolicyClient.ListConstraintsPagedResponse;
import static com.google.cloud.orgpolicy.v2.OrgPolicyClient.ListCustomConstraintsPagedResponse;
import static com.google.cloud.orgpolicy.v2.OrgPolicyClient.ListPoliciesPagedResponse;

import com.google.api.core.ApiFunction;
Expand Down Expand Up @@ -114,6 +115,38 @@ public UnaryCallSettings<DeletePolicyRequest, Empty> deletePolicySettings() {
return ((OrgPolicyStubSettings) getStubSettings()).deletePolicySettings();
}

/** Returns the object with the settings used for calls to createCustomConstraint. */
public UnaryCallSettings<CreateCustomConstraintRequest, CustomConstraint>
createCustomConstraintSettings() {
return ((OrgPolicyStubSettings) getStubSettings()).createCustomConstraintSettings();
}

/** Returns the object with the settings used for calls to updateCustomConstraint. */
public UnaryCallSettings<UpdateCustomConstraintRequest, CustomConstraint>
updateCustomConstraintSettings() {
return ((OrgPolicyStubSettings) getStubSettings()).updateCustomConstraintSettings();
}

/** Returns the object with the settings used for calls to getCustomConstraint. */
public UnaryCallSettings<GetCustomConstraintRequest, CustomConstraint>
getCustomConstraintSettings() {
return ((OrgPolicyStubSettings) getStubSettings()).getCustomConstraintSettings();
}

/** Returns the object with the settings used for calls to listCustomConstraints. */
public PagedCallSettings<
ListCustomConstraintsRequest,
ListCustomConstraintsResponse,
ListCustomConstraintsPagedResponse>
listCustomConstraintsSettings() {
return ((OrgPolicyStubSettings) getStubSettings()).listCustomConstraintsSettings();
}

/** Returns the object with the settings used for calls to deleteCustomConstraint. */
public UnaryCallSettings<DeleteCustomConstraintRequest, Empty> deleteCustomConstraintSettings() {
return ((OrgPolicyStubSettings) getStubSettings()).deleteCustomConstraintSettings();
}

public static final OrgPolicySettings create(OrgPolicyStubSettings stub) throws IOException {
return new OrgPolicySettings.Builder(stub.toBuilder()).build();
}
Expand Down Expand Up @@ -268,6 +301,39 @@ public UnaryCallSettings.Builder<DeletePolicyRequest, Empty> deletePolicySetting
return getStubSettingsBuilder().deletePolicySettings();
}

/** Returns the builder for the settings used for calls to createCustomConstraint. */
public UnaryCallSettings.Builder<CreateCustomConstraintRequest, CustomConstraint>
createCustomConstraintSettings() {
return getStubSettingsBuilder().createCustomConstraintSettings();
}

/** Returns the builder for the settings used for calls to updateCustomConstraint. */
public UnaryCallSettings.Builder<UpdateCustomConstraintRequest, CustomConstraint>
updateCustomConstraintSettings() {
return getStubSettingsBuilder().updateCustomConstraintSettings();
}

/** Returns the builder for the settings used for calls to getCustomConstraint. */
public UnaryCallSettings.Builder<GetCustomConstraintRequest, CustomConstraint>
getCustomConstraintSettings() {
return getStubSettingsBuilder().getCustomConstraintSettings();
}

/** Returns the builder for the settings used for calls to listCustomConstraints. */
public PagedCallSettings.Builder<
ListCustomConstraintsRequest,
ListCustomConstraintsResponse,
ListCustomConstraintsPagedResponse>
listCustomConstraintsSettings() {
return getStubSettingsBuilder().listCustomConstraintsSettings();
}

/** Returns the builder for the settings used for calls to deleteCustomConstraint. */
public UnaryCallSettings.Builder<DeleteCustomConstraintRequest, Empty>
deleteCustomConstraintSettings() {
return getStubSettingsBuilder().deleteCustomConstraintSettings();
}

@Override
public OrgPolicySettings build() throws IOException {
return new OrgPolicySettings(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,21 @@
"grpc": {
"libraryClient": "OrgPolicyClient",
"rpcs": {
"CreateCustomConstraint": {
"methods": ["createCustomConstraint", "createCustomConstraint", "createCustomConstraint", "createCustomConstraintCallable"]
},
"CreatePolicy": {
"methods": ["createPolicy", "createPolicy", "createPolicy", "createPolicy", "createPolicy", "createPolicyCallable"]
},
"DeleteCustomConstraint": {
"methods": ["deleteCustomConstraint", "deleteCustomConstraint", "deleteCustomConstraint", "deleteCustomConstraintCallable"]
},
"DeletePolicy": {
"methods": ["deletePolicy", "deletePolicy", "deletePolicy", "deletePolicyCallable"]
},
"GetCustomConstraint": {
"methods": ["getCustomConstraint", "getCustomConstraint", "getCustomConstraint", "getCustomConstraintCallable"]
},
"GetEffectivePolicy": {
"methods": ["getEffectivePolicy", "getEffectivePolicy", "getEffectivePolicy", "getEffectivePolicyCallable"]
},
Expand All @@ -25,9 +34,15 @@
"ListConstraints": {
"methods": ["listConstraints", "listConstraints", "listConstraints", "listConstraints", "listConstraints", "listConstraintsPagedCallable", "listConstraintsCallable"]
},
"ListCustomConstraints": {
"methods": ["listCustomConstraints", "listCustomConstraints", "listCustomConstraints", "listCustomConstraintsPagedCallable", "listCustomConstraintsCallable"]
},
"ListPolicies": {
"methods": ["listPolicies", "listPolicies", "listPolicies", "listPolicies", "listPolicies", "listPoliciesPagedCallable", "listPoliciesCallable"]
},
"UpdateCustomConstraint": {
"methods": ["updateCustomConstraint", "updateCustomConstraint", "updateCustomConstraintCallable"]
},
"UpdatePolicy": {
"methods": ["updatePolicy", "updatePolicy", "updatePolicyCallable"]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,20 @@
*
* <p>Service Description: An interface for managing organization policies.
*
* <p>The Cloud Org Policy service provides a simple mechanism for organizations to restrict the
* allowed configurations across their entire Cloud Resource hierarchy.
* <p>The Organization Policy Service provides a simple mechanism for organizations to restrict the
* allowed configurations across their entire resource hierarchy.
*
* <p>You can use a `policy` to configure restrictions in Cloud resources. For example, you can
* enforce a `policy` that restricts which Google Cloud Platform APIs can be activated in a certain
* part of your resource hierarchy, or prevents serial port access to VM instances in a particular
* folder.
* <p>You can use a policy to configure restrictions on resources. For example, you can enforce a
* policy that restricts which Google Cloud APIs can be activated in a certain part of your resource
* hierarchy, or prevents serial port access to VM instances in a particular folder.
*
* <p>`Policies` are inherited down through the resource hierarchy. A `policy` applied to a parent
* resource automatically applies to all its child resources unless overridden with a `policy` lower
* <p>Policies are inherited down through the resource hierarchy. A policy applied to a parent
* resource automatically applies to all its child resources unless overridden with a policy lower
* in the hierarchy.
*
* <p>A `constraint` defines an aspect of a resource's configuration that can be controlled by an
* organization's policy administrator. `Policies` are a collection of `constraints` that defines
* their allowable configuration on a particular resource and its child resources.
* <p>A constraint defines an aspect of a resource's configuration that can be controlled by an
* organization's policy administrator. Policies are a collection of constraints that defines their
* allowable configuration on a particular resource and its child resources.
*
* <p>Sample for OrgPolicyClient:
*
Expand Down
Loading
Loading