com.oracle.bmc.identity.requests.CreatePolicyRequest Maven / Gradle / Ivy
/**
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
* This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
*/
package com.oracle.bmc.identity.requests;
import com.oracle.bmc.identity.model.*;
/**
* Example: Click here to see how to use CreatePolicyRequest.
*/
@jakarta.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
public class CreatePolicyRequest
extends com.oracle.bmc.requests.BmcRequest<
com.oracle.bmc.identity.model.CreatePolicyDetails> {
/** Request object for creating a new policy. */
private com.oracle.bmc.identity.model.CreatePolicyDetails createPolicyDetails;
/** Request object for creating a new policy. */
public com.oracle.bmc.identity.model.CreatePolicyDetails getCreatePolicyDetails() {
return createPolicyDetails;
}
/**
* A token that uniquely identifies a request so it can be retried in case of a timeout or
* server error without risk of executing that same action again. Retry tokens expire after 24
* hours, but can be invalidated before then due to conflicting operations (e.g., if a resource
* has been deleted and purged from the system, then a retry of the original creation request
* may be rejected).
*/
private String opcRetryToken;
/**
* A token that uniquely identifies a request so it can be retried in case of a timeout or
* server error without risk of executing that same action again. Retry tokens expire after 24
* hours, but can be invalidated before then due to conflicting operations (e.g., if a resource
* has been deleted and purged from the system, then a retry of the original creation request
* may be rejected).
*/
public String getOpcRetryToken() {
return opcRetryToken;
}
/**
* Alternative accessor for the body parameter.
*
* @return body parameter
*/
@Override
@com.oracle.bmc.InternalSdk
public com.oracle.bmc.identity.model.CreatePolicyDetails getBody$() {
return createPolicyDetails;
}
public static class Builder
implements com.oracle.bmc.requests.BmcRequest.Builder<
CreatePolicyRequest, com.oracle.bmc.identity.model.CreatePolicyDetails> {
private com.oracle.bmc.http.client.RequestInterceptor invocationCallback = null;
private com.oracle.bmc.retrier.RetryConfiguration retryConfiguration = null;
/** Request object for creating a new policy. */
private com.oracle.bmc.identity.model.CreatePolicyDetails createPolicyDetails = null;
/**
* Request object for creating a new policy.
*
* @param createPolicyDetails the value to set
* @return this builder instance
*/
public Builder createPolicyDetails(
com.oracle.bmc.identity.model.CreatePolicyDetails createPolicyDetails) {
this.createPolicyDetails = createPolicyDetails;
return this;
}
/**
* A token that uniquely identifies a request so it can be retried in case of a timeout or
* server error without risk of executing that same action again. Retry tokens expire after
* 24 hours, but can be invalidated before then due to conflicting operations (e.g., if a
* resource has been deleted and purged from the system, then a retry of the original
* creation request may be rejected).
*/
private String opcRetryToken = null;
/**
* A token that uniquely identifies a request so it can be retried in case of a timeout or
* server error without risk of executing that same action again. Retry tokens expire after
* 24 hours, but can be invalidated before then due to conflicting operations (e.g., if a
* resource has been deleted and purged from the system, then a retry of the original
* creation request may be rejected).
*
* @param opcRetryToken the value to set
* @return this builder instance
*/
public Builder opcRetryToken(String opcRetryToken) {
this.opcRetryToken = opcRetryToken;
return this;
}
/**
* Set the invocation callback for the request to be built.
*
* @param invocationCallback the invocation callback to be set for the request
* @return this builder instance
*/
public Builder invocationCallback(
com.oracle.bmc.http.client.RequestInterceptor invocationCallback) {
this.invocationCallback = invocationCallback;
return this;
}
/**
* Set the retry configuration for the request to be built.
*
* @param retryConfiguration the retry configuration to be used for the request
* @return this builder instance
*/
public Builder retryConfiguration(
com.oracle.bmc.retrier.RetryConfiguration retryConfiguration) {
this.retryConfiguration = retryConfiguration;
return this;
}
/**
* Copy method to populate the builder with values from the given instance.
*
* @return this builder instance
*/
public Builder copy(CreatePolicyRequest o) {
createPolicyDetails(o.getCreatePolicyDetails());
opcRetryToken(o.getOpcRetryToken());
invocationCallback(o.getInvocationCallback());
retryConfiguration(o.getRetryConfiguration());
return this;
}
/**
* Build the instance of CreatePolicyRequest as configured by this builder
*
* Note that this method takes calls to {@link
* Builder#invocationCallback(com.oracle.bmc.http.client.RequestInterceptor)} into account,
* while the method {@link Builder#buildWithoutInvocationCallback} does not.
*
*
This is the preferred method to build an instance.
*
* @return instance of CreatePolicyRequest
*/
public CreatePolicyRequest build() {
CreatePolicyRequest request = buildWithoutInvocationCallback();
request.setInvocationCallback(invocationCallback);
request.setRetryConfiguration(retryConfiguration);
return request;
}
/**
* Alternative setter for the body parameter.
*
* @param body the body parameter
* @return this builder instance
*/
@com.oracle.bmc.InternalSdk
public Builder body$(com.oracle.bmc.identity.model.CreatePolicyDetails body) {
createPolicyDetails(body);
return this;
}
/**
* Build the instance of CreatePolicyRequest as configured by this builder
*
*
Note that this method does not take calls to {@link
* Builder#invocationCallback(com.oracle.bmc.http.client.RequestInterceptor)} into account,
* while the method {@link Builder#build} does
*
* @return instance of CreatePolicyRequest
*/
public CreatePolicyRequest buildWithoutInvocationCallback() {
CreatePolicyRequest request = new CreatePolicyRequest();
request.createPolicyDetails = createPolicyDetails;
request.opcRetryToken = opcRetryToken;
return request;
// new CreatePolicyRequest(createPolicyDetails, opcRetryToken);
}
}
/**
* Return an instance of {@link Builder} that allows you to modify request properties.
*
* @return instance of {@link Builder} that allows you to modify request properties.
*/
public Builder toBuilder() {
return new Builder().createPolicyDetails(createPolicyDetails).opcRetryToken(opcRetryToken);
}
/**
* Return a new builder for this request object.
*
* @return builder for the request object
*/
public static Builder builder() {
return new Builder();
}
@Override
public String toString() {
java.lang.StringBuilder sb = new java.lang.StringBuilder();
sb.append("(");
sb.append("super=").append(super.toString());
sb.append(",createPolicyDetails=").append(String.valueOf(this.createPolicyDetails));
sb.append(",opcRetryToken=").append(String.valueOf(this.opcRetryToken));
sb.append(")");
return sb.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof CreatePolicyRequest)) {
return false;
}
CreatePolicyRequest other = (CreatePolicyRequest) o;
return super.equals(o)
&& java.util.Objects.equals(this.createPolicyDetails, other.createPolicyDetails)
&& java.util.Objects.equals(this.opcRetryToken, other.opcRetryToken);
}
@Override
public int hashCode() {
final int PRIME = 59;
int result = super.hashCode();
result =
(result * PRIME)
+ (this.createPolicyDetails == null
? 43
: this.createPolicyDetails.hashCode());
result =
(result * PRIME)
+ (this.opcRetryToken == null ? 43 : this.opcRetryToken.hashCode());
return result;
}
}