Skip to content

Commit

Permalink
fix(Configuration Governance): re-gen service after recent API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
padamstx committed Jan 14, 2021
1 parent 0dbdc8a commit a499ded
Show file tree
Hide file tree
Showing 24 changed files with 226 additions and 269 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2020.
* (C) Copyright IBM Corp. 2021.
*
* 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
Expand All @@ -12,7 +12,7 @@
*/

/*
* IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-d753183b-20201209-163011
* IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-c6db7f4a-20210114-141015
*/

package com.ibm.cloud.platform_services.configuration_governance.v1;
Expand Down Expand Up @@ -114,7 +114,9 @@ public ServiceCall<CreateRulesResponse> createRules(CreateRulesOptions createRul
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
builder.header("Transaction-Id", createRulesOptions.transactionId());
if (createRulesOptions.transactionId() != null) {
builder.header("Transaction-Id", createRulesOptions.transactionId());
}
final JsonObject contentJson = new JsonObject();
contentJson.add("rules", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRulesOptions.rules()));
builder.bodyJson(contentJson);
Expand All @@ -140,7 +142,9 @@ public ServiceCall<RuleList> listRules(ListRulesOptions listRulesOptions) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
builder.header("Transaction-Id", listRulesOptions.transactionId());
if (listRulesOptions.transactionId() != null) {
builder.header("Transaction-Id", listRulesOptions.transactionId());
}
builder.query("account_id", String.valueOf(listRulesOptions.accountId()));
if (listRulesOptions.attached() != null) {
builder.query("attached", String.valueOf(listRulesOptions.attached()));
Expand Down Expand Up @@ -181,7 +185,9 @@ public ServiceCall<Rule> getRule(GetRuleOptions getRuleOptions) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
builder.header("Transaction-Id", getRuleOptions.transactionId());
if (getRuleOptions.transactionId() != null) {
builder.header("Transaction-Id", getRuleOptions.transactionId());
}
ResponseConverter<Rule> responseConverter =
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<Rule>() { }.getType());
return createServiceCall(builder.build(), responseConverter);
Expand All @@ -206,8 +212,10 @@ public ServiceCall<Rule> updateRule(UpdateRuleOptions updateRuleOptions) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
builder.header("Transaction-Id", updateRuleOptions.transactionId());
builder.header("If-Match", updateRuleOptions.ifMatch());
if (updateRuleOptions.transactionId() != null) {
builder.header("Transaction-Id", updateRuleOptions.transactionId());
}
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("name", updateRuleOptions.name());
contentJson.addProperty("description", updateRuleOptions.description());
Expand Down Expand Up @@ -247,7 +255,9 @@ public ServiceCall<Void> deleteRule(DeleteRuleOptions deleteRuleOptions) {
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Transaction-Id", deleteRuleOptions.transactionId());
if (deleteRuleOptions.transactionId() != null) {
builder.header("Transaction-Id", deleteRuleOptions.transactionId());
}
ResponseConverter<Void> responseConverter = ResponseConverterUtils.getVoid();
return createServiceCall(builder.build(), responseConverter);
}
Expand Down Expand Up @@ -275,7 +285,9 @@ public ServiceCall<CreateAttachmentsResponse> createAttachments(CreateAttachment
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
builder.header("Transaction-Id", createAttachmentsOptions.transactionId());
if (createAttachmentsOptions.transactionId() != null) {
builder.header("Transaction-Id", createAttachmentsOptions.transactionId());
}
final JsonObject contentJson = new JsonObject();
contentJson.add("attachments", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createAttachmentsOptions.attachments()));
builder.bodyJson(contentJson);
Expand Down Expand Up @@ -303,7 +315,9 @@ public ServiceCall<AttachmentList> listAttachments(ListAttachmentsOptions listAt
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
builder.header("Transaction-Id", listAttachmentsOptions.transactionId());
if (listAttachmentsOptions.transactionId() != null) {
builder.header("Transaction-Id", listAttachmentsOptions.transactionId());
}
if (listAttachmentsOptions.limit() != null) {
builder.query("limit", String.valueOf(listAttachmentsOptions.limit()));
}
Expand Down Expand Up @@ -335,7 +349,9 @@ public ServiceCall<Attachment> getAttachment(GetAttachmentOptions getAttachmentO
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
builder.header("Transaction-Id", getAttachmentOptions.transactionId());
if (getAttachmentOptions.transactionId() != null) {
builder.header("Transaction-Id", getAttachmentOptions.transactionId());
}
ResponseConverter<Attachment> responseConverter =
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<Attachment>() { }.getType());
return createServiceCall(builder.build(), responseConverter);
Expand All @@ -361,8 +377,10 @@ public ServiceCall<Attachment> updateAttachment(UpdateAttachmentOptions updateAt
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
builder.header("Transaction-Id", updateAttachmentOptions.transactionId());
builder.header("If-Match", updateAttachmentOptions.ifMatch());
if (updateAttachmentOptions.transactionId() != null) {
builder.header("Transaction-Id", updateAttachmentOptions.transactionId());
}
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("account_id", updateAttachmentOptions.accountId());
contentJson.add("included_scope", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateAttachmentOptions.includedScope()));
Expand Down Expand Up @@ -394,7 +412,9 @@ public ServiceCall<Void> deleteAttachment(DeleteAttachmentOptions deleteAttachme
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Transaction-Id", deleteAttachmentOptions.transactionId());
if (deleteAttachmentOptions.transactionId() != null) {
builder.header("Transaction-Id", deleteAttachmentOptions.transactionId());
}
ResponseConverter<Void> responseConverter = ResponseConverterUtils.getVoid();
return createServiceCall(builder.build(), responseConverter);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2020.
* (C) Copyright IBM Corp. 2021.
*
* 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
Expand All @@ -23,21 +23,21 @@
public class CreateAttachmentsOptions extends GenericModel {

protected String ruleId;
protected String transactionId;
protected List<AttachmentRequest> attachments;
protected String transactionId;

/**
* Builder.
*/
public static class Builder {
private String ruleId;
private String transactionId;
private List<AttachmentRequest> attachments;
private String transactionId;

private Builder(CreateAttachmentsOptions createAttachmentsOptions) {
this.ruleId = createAttachmentsOptions.ruleId;
this.transactionId = createAttachmentsOptions.transactionId;
this.attachments = createAttachmentsOptions.attachments;
this.transactionId = createAttachmentsOptions.transactionId;
}

/**
Expand All @@ -50,12 +50,10 @@ public Builder() {
* Instantiates a new builder with required properties.
*
* @param ruleId the ruleId
* @param transactionId the transactionId
* @param attachments the attachments
*/
public Builder(String ruleId, String transactionId, List<AttachmentRequest> attachments) {
public Builder(String ruleId, List<AttachmentRequest> attachments) {
this.ruleId = ruleId;
this.transactionId = transactionId;
this.attachments = attachments;
}

Expand Down Expand Up @@ -96,39 +94,37 @@ public Builder ruleId(String ruleId) {
}

/**
* Set the transactionId.
* Set the attachments.
* Existing attachments will be replaced.
*
* @param transactionId the transactionId
* @param attachments the attachments
* @return the CreateAttachmentsOptions builder
*/
public Builder transactionId(String transactionId) {
this.transactionId = transactionId;
public Builder attachments(List<AttachmentRequest> attachments) {
this.attachments = attachments;
return this;
}

/**
* Set the attachments.
* Existing attachments will be replaced.
* Set the transactionId.
*
* @param attachments the attachments
* @param transactionId the transactionId
* @return the CreateAttachmentsOptions builder
*/
public Builder attachments(List<AttachmentRequest> attachments) {
this.attachments = attachments;
public Builder transactionId(String transactionId) {
this.transactionId = transactionId;
return this;
}
}

protected CreateAttachmentsOptions(Builder builder) {
com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.ruleId,
"ruleId cannot be empty");
com.ibm.cloud.sdk.core.util.Validator.notNull(builder.transactionId,
"transactionId cannot be null");
com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attachments,
"attachments cannot be null");
ruleId = builder.ruleId;
transactionId = builder.transactionId;
attachments = builder.attachments;
transactionId = builder.transactionId;
}

/**
Expand All @@ -151,12 +147,21 @@ public String ruleId() {
return ruleId;
}

/**
* Gets the attachments.
*
* @return the attachments
*/
public List<AttachmentRequest> attachments() {
return attachments;
}

/**
* Gets the transactionId.
*
* The unique identifier that is used to trace an entire request. If you omit this field, the service generates and
* sends a transaction ID in the
* `trace` field of the response body.
* sends a transaction ID as a response header of the request. In the case of an error, the transaction ID is set in
* the `trace` field of the response body.
*
* **Note:** To help with debugging logs, it is strongly recommended that you generate and supply a `Transaction-Id`
* with each request.
Expand All @@ -166,14 +171,5 @@ public String ruleId() {
public String transactionId() {
return transactionId;
}

/**
* Gets the attachments.
*
* @return the attachments
*/
public List<AttachmentRequest> attachments() {
return attachments;
}
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2020.
* (C) Copyright IBM Corp. 2021.
*
* 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
Expand All @@ -22,19 +22,19 @@
*/
public class CreateRulesOptions extends GenericModel {

protected String transactionId;
protected List<CreateRuleRequest> rules;
protected String transactionId;

/**
* Builder.
*/
public static class Builder {
private String transactionId;
private List<CreateRuleRequest> rules;
private String transactionId;

private Builder(CreateRulesOptions createRulesOptions) {
this.transactionId = createRulesOptions.transactionId;
this.rules = createRulesOptions.rules;
this.transactionId = createRulesOptions.transactionId;
}

/**
Expand All @@ -46,11 +46,9 @@ public Builder() {
/**
* Instantiates a new builder with required properties.
*
* @param transactionId the transactionId
* @param rules the rules
*/
public Builder(String transactionId, List<CreateRuleRequest> rules) {
this.transactionId = transactionId;
public Builder(List<CreateRuleRequest> rules) {
this.rules = rules;
}

Expand Down Expand Up @@ -80,36 +78,34 @@ public Builder addRule(CreateRuleRequest rule) {
}

/**
* Set the transactionId.
* Set the rules.
* Existing rules will be replaced.
*
* @param transactionId the transactionId
* @param rules the rules
* @return the CreateRulesOptions builder
*/
public Builder transactionId(String transactionId) {
this.transactionId = transactionId;
public Builder rules(List<CreateRuleRequest> rules) {
this.rules = rules;
return this;
}

/**
* Set the rules.
* Existing rules will be replaced.
* Set the transactionId.
*
* @param rules the rules
* @param transactionId the transactionId
* @return the CreateRulesOptions builder
*/
public Builder rules(List<CreateRuleRequest> rules) {
this.rules = rules;
public Builder transactionId(String transactionId) {
this.transactionId = transactionId;
return this;
}
}

protected CreateRulesOptions(Builder builder) {
com.ibm.cloud.sdk.core.util.Validator.notNull(builder.transactionId,
"transactionId cannot be null");
com.ibm.cloud.sdk.core.util.Validator.notNull(builder.rules,
"rules cannot be null");
transactionId = builder.transactionId;
rules = builder.rules;
transactionId = builder.transactionId;
}

/**
Expand All @@ -121,12 +117,23 @@ public Builder newBuilder() {
return new Builder(this);
}

/**
* Gets the rules.
*
* A list of rules to be created.
*
* @return the rules
*/
public List<CreateRuleRequest> rules() {
return rules;
}

/**
* Gets the transactionId.
*
* The unique identifier that is used to trace an entire request. If you omit this field, the service generates and
* sends a transaction ID in the
* `trace` field of the response body.
* sends a transaction ID as a response header of the request. In the case of an error, the transaction ID is set in
* the `trace` field of the response body.
*
* **Note:** To help with debugging logs, it is strongly recommended that you generate and supply a `Transaction-Id`
* with each request.
Expand All @@ -136,16 +143,5 @@ public Builder newBuilder() {
public String transactionId() {
return transactionId;
}

/**
* Gets the rules.
*
* A list of rules to be created.
*
* @return the rules
*/
public List<CreateRuleRequest> rules() {
return rules;
}
}

Loading

0 comments on commit a499ded

Please sign in to comment.